This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[PATCH] Minor problem in cookie.t
[perl5.git] / dist / Math-BigInt-FastCalc / lib / Math / BigInt / FastCalc.pm
1 package Math::BigInt::FastCalc;
2
3 use 5.006;
4 use strict;
5 use warnings;
6
7 use Math::BigInt::Calc 0.56;
8
9 use vars '$VERSION';
10
11 $VERSION = '0.24_01';
12
13 ##############################################################################
14 # global constants, flags and accessory
15
16 # announce that we are compatible with MBI v1.70 and up
17 sub api_version () { 1; }
18
19 # use Calc to override the methods that we do not provide in XS
20
21 for my $method (qw/
22     str
23     add sub mul div
24     rsft lsft
25     mod modpow modinv
26     gcd
27     pow root sqrt log_int fac nok
28     digit check
29     from_hex from_bin from_oct as_hex as_bin as_oct
30     zeros base_len
31     xor or and
32     alen 1ex
33     /)
34     {
35     no strict 'refs';
36     *{'Math::BigInt::FastCalc::_' . $method} = \&{'Math::BigInt::Calc::_' . $method};
37     }
38
39 require XSLoader;
40 XSLoader::load(__PACKAGE__, $VERSION, Math::BigInt::Calc::_base_len());
41
42 ##############################################################################
43 ##############################################################################
44
45 1;
46 __END__
47 =pod
48
49 =head1 NAME
50
51 Math::BigInt::FastCalc - Math::BigInt::Calc with some XS for more speed
52
53 =head1 SYNOPSIS
54
55 Provides support for big integer calculations. Not intended to be used by
56 other modules. Other modules which sport the same functions can also be used
57 to support Math::BigInt, like L<Math::BigInt::GMP> or L<Math::BigInt::Pari>.
58
59 =head1 DESCRIPTION
60
61 In order to allow for multiple big integer libraries, Math::BigInt was
62 rewritten to use library modules for core math routines. Any module which
63 follows the same API as this can be used instead by using the following:
64
65         use Math::BigInt lib => 'libname';
66
67 'libname' is either the long name ('Math::BigInt::Pari'), or only the short
68 version like 'Pari'. To use this library:
69
70         use Math::BigInt lib => 'FastCalc';
71
72 Note that from L<Math::BigInt> v1.76 onwards, FastCalc will be loaded
73 automatically, if possible.
74
75 =head1 STORAGE
76
77 FastCalc works exactly like Calc, in stores the numbers in decimal form,
78 chopped into parts.
79
80 =head1 METHODS
81
82 The following functions are now implemented in FastCalc.xs:
83
84         _is_odd         _is_even        _is_one         _is_zero
85         _is_two         _is_ten
86         _zero           _one            _two            _ten
87         _acmp           _len            _num
88         _inc            _dec
89         __strip_zeros   _copy
90
91 =head1 LICENSE
92
93 This program is free software; you may redistribute it and/or modify it under
94 the same terms as Perl itself.
95
96 =head1 AUTHORS
97
98 Original math code by Mark Biggar, rewritten by Tels L<http://bloodgate.com/>
99 in late 2000.
100 Seperated from BigInt and shaped API with the help of John Peacock.
101 Fixed, sped-up and enhanced by Tels http://bloodgate.com 2001-2003.
102 Further streamlining (api_version 1 etc.) by Tels 2004-2007.
103
104 =head1 SEE ALSO
105
106 L<Math::BigInt>, L<Math::BigFloat>,
107 L<Math::BigInt::GMP>, L<Math::BigInt::FastCalc> and L<Math::BigInt::Pari>.
108
109 =cut