This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Math::BigInt::FastCalc from 0.31 to 0.34
[perl5.git] / cpan / 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 1.997;
8
9 use vars '$VERSION';
10
11 $VERSION = '0.34';
12
13 ##############################################################################
14 # global constants, flags and accessory
15
16 # announce that we are compatible with MBI v1.83 and up
17 sub api_version () { 2; }
18
19 # use Calc to override the methods that we do not provide in XS
20
21 for my $method (qw/
22     str num
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
47 __END__
48
49 =pod
50
51 =head1 NAME
52
53 Math::BigInt::FastCalc - Math::BigInt::Calc with some XS for more speed
54
55 =head1 SYNOPSIS
56
57 Provides support for big integer calculations. Not intended to be used by
58 other modules. Other modules which sport the same functions can also be used
59 to support Math::BigInt, like L<Math::BigInt::GMP> or L<Math::BigInt::Pari>.
60
61 =head1 DESCRIPTION
62
63 In order to allow for multiple big integer libraries, Math::BigInt was
64 rewritten to use library modules for core math routines. Any module which
65 follows the same API as this can be used instead by using the following:
66
67         use Math::BigInt lib => 'libname';
68
69 'libname' is either the long name ('Math::BigInt::Pari'), or only the short
70 version like 'Pari'. To use this library:
71
72         use Math::BigInt lib => 'FastCalc';
73
74 Note that from L<Math::BigInt> v1.76 onwards, FastCalc will be loaded
75 automatically, if possible.
76
77 =head1 STORAGE
78
79 FastCalc works exactly like Calc, in stores the numbers in decimal form,
80 chopped into parts.
81
82 =head1 METHODS
83
84 The following functions are now implemented in FastCalc.xs:
85
86         _is_odd         _is_even        _is_one         _is_zero
87         _is_two         _is_ten
88         _zero           _one            _two            _ten
89         _acmp           _len
90         _inc            _dec
91         __strip_zeros   _copy
92
93 =head1 BUGS
94
95 Please report any bugs or feature requests to
96 C<bug-math-bigint-fastcalc at rt.cpan.org>, or through the web interface at
97 L<https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigInt-FastCalc>
98 (requires login).
99 We will be notified, and then you'll automatically be notified of progress on
100 your bug as I make changes.
101
102 =head1 SUPPORT
103
104 You can find documentation for this module with the perldoc command.
105
106     perldoc Math::BigInt::FastCalc
107
108 You can also look for information at:
109
110 =over 4
111
112 =item * RT: CPAN's request tracker
113
114 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt-FastCalc>
115
116 =item * AnnoCPAN: Annotated CPAN documentation
117
118 L<http://annocpan.org/dist/Math-BigInt-FastCalc>
119
120 =item * CPAN Ratings
121
122 L<http://cpanratings.perl.org/dist/Math-BigInt-FastCalc>
123
124 =item * Search CPAN
125
126 L<http://search.cpan.org/dist/Math-BigInt-FastCalc/>
127
128 =item * CPAN Testers Matrix
129
130 L<http://matrix.cpantesters.org/?dist=Math-BigInt-FastCalc>
131
132 =item * The Bignum mailing list
133
134 =over 4
135
136 =item * Post to mailing list
137
138 C<bignum at lists.scsys.co.uk>
139
140 =item * View mailing list
141
142 L<http://lists.scsys.co.uk/pipermail/bignum/>
143
144 =item * Subscribe/Unsubscribe
145
146 L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum>
147
148 =back
149
150 =back
151
152 =head1 LICENSE
153
154 This program is free software; you may redistribute it and/or modify it under
155 the same terms as Perl itself.
156
157 =head1 AUTHORS
158
159 Original math code by Mark Biggar, rewritten by Tels L<http://bloodgate.com/>
160 in late 2000.
161 Separated from BigInt and shaped API with the help of John Peacock.
162
163 Fixed, sped-up and enhanced by Tels http://bloodgate.com 2001-2003.
164 Further streamlining (api_version 1 etc.) by Tels 2004-2007.
165
166 Bug-fixing by Peter John Acklam E<lt>pjacklam@online.noE<gt> 2010-2015.
167
168 =head1 SEE ALSO
169
170 L<Math::BigInt>, L<Math::BigFloat>, and the other backends
171 L<Math::BigInt::Calc>, L<Math::BigInt::GMP>, and L<Math::BigInt::Pari>.
172
173 =cut