FastCalc.pm revision 1.1
1package Math::BigInt::FastCalc; 2 3use 5.006; 4use strict; 5use warnings; 6 7use Math::BigInt::Calc 1.999706; 8 9our $VERSION = '0.40'; 10 11############################################################################## 12# global constants, flags and accessory 13 14# announce that we are compatible with MBI v1.83 and up 15sub api_version () { 2; } 16 17# use Calc to override the methods that we do not provide in XS 18 19for my $method (qw/ 20 str num 21 add sub mul div 22 rsft lsft 23 mod modpow modinv 24 gcd 25 pow root sqrt log_int fac nok 26 digit check 27 from_hex from_bin from_oct as_hex as_bin as_oct 28 zeros base_len 29 xor or and 30 alen 1ex 31 /) 32 { 33 no strict 'refs'; 34 *{'Math::BigInt::FastCalc::_' . $method} = \&{'Math::BigInt::Calc::_' . $method}; 35 } 36 37require XSLoader; 38XSLoader::load(__PACKAGE__, $VERSION, Math::BigInt::Calc::_base_len()); 39 40############################################################################## 41############################################################################## 42 431; 44 45__END__ 46 47=pod 48 49=head1 NAME 50 51Math::BigInt::FastCalc - Math::BigInt::Calc with some XS for more speed 52 53=head1 SYNOPSIS 54 55Provides support for big integer calculations. Not intended to be used by 56other modules. Other modules which sport the same functions can also be used 57to support Math::BigInt, like L<Math::BigInt::GMP> or L<Math::BigInt::Pari>. 58 59=head1 DESCRIPTION 60 61In order to allow for multiple big integer libraries, Math::BigInt was 62rewritten to use library modules for core math routines. Any module which 63follows 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 68version like 'Pari'. To use this library: 69 70 use Math::BigInt lib => 'FastCalc'; 71 72Note that from L<Math::BigInt> v1.76 onwards, FastCalc will be loaded 73automatically, if possible. 74 75=head1 STORAGE 76 77FastCalc works exactly like Calc, in stores the numbers in decimal form, 78chopped into parts. 79 80=head1 METHODS 81 82The 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 88 _inc _dec 89 __strip_zeros _copy 90 91=head1 BUGS 92 93Please report any bugs or feature requests to 94C<bug-math-bigint-fastcalc at rt.cpan.org>, or through the web interface at 95L<https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigInt-FastCalc> 96(requires login). 97We will be notified, and then you'll automatically be notified of progress on 98your bug as I make changes. 99 100=head1 SUPPORT 101 102You can find documentation for this module with the perldoc command. 103 104 perldoc Math::BigInt::FastCalc 105 106You can also look for information at: 107 108=over 4 109 110=item * RT: CPAN's request tracker 111 112L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt-FastCalc> 113 114=item * AnnoCPAN: Annotated CPAN documentation 115 116L<http://annocpan.org/dist/Math-BigInt-FastCalc> 117 118=item * CPAN Ratings 119 120L<http://cpanratings.perl.org/dist/Math-BigInt-FastCalc> 121 122=item * Search CPAN 123 124L<http://search.cpan.org/dist/Math-BigInt-FastCalc/> 125 126=item * CPAN Testers Matrix 127 128L<http://matrix.cpantesters.org/?dist=Math-BigInt-FastCalc> 129 130=item * The Bignum mailing list 131 132=over 4 133 134=item * Post to mailing list 135 136C<bignum at lists.scsys.co.uk> 137 138=item * View mailing list 139 140L<http://lists.scsys.co.uk/pipermail/bignum/> 141 142=item * Subscribe/Unsubscribe 143 144L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> 145 146=back 147 148=back 149 150=head1 LICENSE 151 152This program is free software; you may redistribute it and/or modify it under 153the same terms as Perl itself. 154 155=head1 AUTHORS 156 157Original math code by Mark Biggar, rewritten by Tels L<http://bloodgate.com/> 158in late 2000. 159Separated from BigInt and shaped API with the help of John Peacock. 160 161Fixed, sped-up and enhanced by Tels http://bloodgate.com 2001-2003. 162Further streamlining (api_version 1 etc.) by Tels 2004-2007. 163 164Bug-fixing by Peter John Acklam E<lt>pjacklam@online.noE<gt> 2010-2015. 165 166=head1 SEE ALSO 167 168L<Math::BigInt>, L<Math::BigFloat>, and the other backends 169L<Math::BigInt::Calc>, L<Math::BigInt::GMP>, and L<Math::BigInt::Pari>. 170 171=cut 172