1 package Math::BigInt::FastCalc;
5 # use warnings; # dont use warnings for older Perls
8 use Math::BigInt::Calc;
10 use vars qw/@ISA $VERSION $BASE $BASE_LEN/;
12 @ISA = qw(DynaLoader);
16 bootstrap Math::BigInt::FastCalc $VERSION;
18 ##############################################################################
19 # global constants, flags and accessory
21 # announce that we are compatible with MBI v1.70 and up
22 sub api_version () { 1; }
26 # use Calc to override the methods that we do not provide in XS
34 pow root sqrt log_int fac
36 from_hex from_bin as_hex as_bin
42 *{'Math::BigInt::FastCalc::_' . $method} = \&{'Math::BigInt::Calc::_' . $method};
44 my ($AND_BITS, $XOR_BITS, $OR_BITS, $BASE_LEN_SMALL, $MAX_VAL);
46 # store BASE_LEN and BASE to later pass it to XS code
47 ($BASE_LEN, $AND_BITS, $XOR_BITS, $OR_BITS, $BASE_LEN_SMALL, $MAX_VAL, $BASE) =
48 Math::BigInt::Calc::_base_len();
54 _set_XS_BASE($BASE, $BASE_LEN);
57 ##############################################################################
58 ##############################################################################
65 Math::BigInt::FastCalc - Math::BigInt::Calc with some XS for more speed
69 Provides support for big integer calculations. Not intended to be used by
70 other modules. Other modules which sport the same functions can also be used
71 to support Math::BigInt, like L<Math::BigInt::GMP> or L<Math::BigInt::Pari>.
75 In order to allow for multiple big integer libraries, Math::BigInt was
76 rewritten to use library modules for core math routines. Any module which
77 follows the same API as this can be used instead by using the following:
79 use Math::BigInt lib => 'libname';
81 'libname' is either the long name ('Math::BigInt::Pari'), or only the short
82 version like 'Pari'. To use this library:
84 use Math::BigInt lib => 'FastCalc';
86 Note that from L<Math::BigInt> v1.76 onwards, FastCalc will be loaded
87 automatically, if possible.
91 FastCalc works exactly like Calc, in stores the numbers in decimal form,
96 The following functions are now implemented in FastCalc.xs:
98 _is_odd _is_even _is_one _is_zero
107 This program is free software; you may redistribute it and/or modify it under
108 the same terms as Perl itself.
112 Original math code by Mark Biggar, rewritten by Tels L<http://bloodgate.com/>
114 Seperated from BigInt and shaped API with the help of John Peacock.
115 Fixed, sped-up and enhanced by Tels http://bloodgate.com 2001-2003.
116 Further streamlining (api_version 1 etc) by Tels 2004-2005.
120 L<Math::BigInt>, L<Math::BigFloat>, L<Math::BigInt::BitVect>,
121 L<Math::BigInt::GMP>, L<Math::BigInt::FastCalc> and L<Math::BigInt::Pari>.