1*0Sstevel@tonic-gatepackage bigint; 2*0Sstevel@tonic-gaterequire 5.005; 3*0Sstevel@tonic-gate 4*0Sstevel@tonic-gate$VERSION = '0.05'; 5*0Sstevel@tonic-gateuse Exporter; 6*0Sstevel@tonic-gate@ISA = qw( Exporter ); 7*0Sstevel@tonic-gate@EXPORT_OK = qw( ); 8*0Sstevel@tonic-gate@EXPORT = qw( inf NaN ); 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gateuse strict; 11*0Sstevel@tonic-gateuse overload; 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate############################################################################## 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate# These are all alike, and thus faked by AUTOLOAD 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gatemy @faked = qw/round_mode accuracy precision div_scale/; 18*0Sstevel@tonic-gateuse vars qw/$VERSION $AUTOLOAD $_lite/; # _lite for testsuite 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gatesub AUTOLOAD 21*0Sstevel@tonic-gate { 22*0Sstevel@tonic-gate my $name = $AUTOLOAD; 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gate $name =~ s/.*:://; # split package 25*0Sstevel@tonic-gate no strict 'refs'; 26*0Sstevel@tonic-gate foreach my $n (@faked) 27*0Sstevel@tonic-gate { 28*0Sstevel@tonic-gate if ($n eq $name) 29*0Sstevel@tonic-gate { 30*0Sstevel@tonic-gate *{"bigint::$name"} = sub 31*0Sstevel@tonic-gate { 32*0Sstevel@tonic-gate my $self = shift; 33*0Sstevel@tonic-gate no strict 'refs'; 34*0Sstevel@tonic-gate if (defined $_[0]) 35*0Sstevel@tonic-gate { 36*0Sstevel@tonic-gate return Math::BigInt->$name($_[0]); 37*0Sstevel@tonic-gate } 38*0Sstevel@tonic-gate return Math::BigInt->$name(); 39*0Sstevel@tonic-gate }; 40*0Sstevel@tonic-gate return &$name; 41*0Sstevel@tonic-gate } 42*0Sstevel@tonic-gate } 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate # delayed load of Carp and avoid recursion 45*0Sstevel@tonic-gate require Carp; 46*0Sstevel@tonic-gate Carp::croak ("Can't call bigint\-\>$name, not a valid method"); 47*0Sstevel@tonic-gate } 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gatesub upgrade 50*0Sstevel@tonic-gate { 51*0Sstevel@tonic-gate my $self = shift; 52*0Sstevel@tonic-gate no strict 'refs'; 53*0Sstevel@tonic-gate# if (defined $_[0]) 54*0Sstevel@tonic-gate# { 55*0Sstevel@tonic-gate# $Math::BigInt::upgrade = $_[0]; 56*0Sstevel@tonic-gate# } 57*0Sstevel@tonic-gate return $Math::BigInt::upgrade; 58*0Sstevel@tonic-gate } 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gatesub _constant 61*0Sstevel@tonic-gate { 62*0Sstevel@tonic-gate # this takes a floating point constant string and returns it truncated to 63*0Sstevel@tonic-gate # integer. For instance, '4.5' => '4', '1.234e2' => '123' etc 64*0Sstevel@tonic-gate my $float = shift; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate # some simple cases first 67*0Sstevel@tonic-gate return $float if ($float =~ /^[+-]?[0-9]+$/); # '+123','-1','0' etc 68*0Sstevel@tonic-gate return $float 69*0Sstevel@tonic-gate if ($float =~ /^[+-]?[0-9]+\.?[eE]\+?[0-9]+$/); # 123e2, 123.e+2 70*0Sstevel@tonic-gate return '0' if ($float =~ /^[+-]?[0]*\.[0-9]+$/); # .2, 0.2, -.1 71*0Sstevel@tonic-gate if ($float =~ /^[+-]?[0-9]+\.[0-9]*$/) # 1., 1.23, -1.2 etc 72*0Sstevel@tonic-gate { 73*0Sstevel@tonic-gate $float =~ s/\..*//; 74*0Sstevel@tonic-gate return $float; 75*0Sstevel@tonic-gate } 76*0Sstevel@tonic-gate my ($mis,$miv,$mfv,$es,$ev) = Math::BigInt::_split($float); 77*0Sstevel@tonic-gate return $float if !defined $mis; # doesn't look like a number to me 78*0Sstevel@tonic-gate my $ec = int($$ev); 79*0Sstevel@tonic-gate my $sign = $$mis; $sign = '' if $sign eq '+'; 80*0Sstevel@tonic-gate if ($$es eq '-') 81*0Sstevel@tonic-gate { 82*0Sstevel@tonic-gate # ignore fraction part entirely 83*0Sstevel@tonic-gate if ($ec >= length($$miv)) # 123.23E-4 84*0Sstevel@tonic-gate { 85*0Sstevel@tonic-gate return '0'; 86*0Sstevel@tonic-gate } 87*0Sstevel@tonic-gate return $sign . substr ($$miv,0,length($$miv)-$ec); # 1234.45E-2 = 12 88*0Sstevel@tonic-gate } 89*0Sstevel@tonic-gate # xE+y 90*0Sstevel@tonic-gate if ($ec >= length($$mfv)) 91*0Sstevel@tonic-gate { 92*0Sstevel@tonic-gate $ec -= length($$mfv); 93*0Sstevel@tonic-gate return $sign.$$miv.$$mfv if $ec == 0; # 123.45E+2 => 12345 94*0Sstevel@tonic-gate return $sign.$$miv.$$mfv.'E'.$ec; # 123.45e+3 => 12345e1 95*0Sstevel@tonic-gate } 96*0Sstevel@tonic-gate $mfv = substr($$mfv,0,$ec); 97*0Sstevel@tonic-gate return $sign.$$miv.$mfv; # 123.45e+1 => 1234 98*0Sstevel@tonic-gate } 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gatesub import 101*0Sstevel@tonic-gate { 102*0Sstevel@tonic-gate my $self = shift; 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate # some defaults 105*0Sstevel@tonic-gate my $lib = 'Calc'; 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate my @import = ( ':constant' ); # drive it w/ constant 108*0Sstevel@tonic-gate my @a = @_; my $l = scalar @_; my $j = 0; 109*0Sstevel@tonic-gate my ($ver,$trace); # version? trace? 110*0Sstevel@tonic-gate my ($a,$p); # accuracy, precision 111*0Sstevel@tonic-gate for ( my $i = 0; $i < $l ; $i++,$j++ ) 112*0Sstevel@tonic-gate { 113*0Sstevel@tonic-gate if ($_[$i] =~ /^(l|lib)$/) 114*0Sstevel@tonic-gate { 115*0Sstevel@tonic-gate # this causes a different low lib to take care... 116*0Sstevel@tonic-gate $lib = $_[$i+1] || ''; 117*0Sstevel@tonic-gate my $s = 2; $s = 1 if @a-$j < 2; # avoid "can not modify non-existant..." 118*0Sstevel@tonic-gate splice @a, $j, $s; $j -= $s; $i++; 119*0Sstevel@tonic-gate } 120*0Sstevel@tonic-gate elsif ($_[$i] =~ /^(a|accuracy)$/) 121*0Sstevel@tonic-gate { 122*0Sstevel@tonic-gate $a = $_[$i+1]; 123*0Sstevel@tonic-gate my $s = 2; $s = 1 if @a-$j < 2; # avoid "can not modify non-existant..." 124*0Sstevel@tonic-gate splice @a, $j, $s; $j -= $s; $i++; 125*0Sstevel@tonic-gate } 126*0Sstevel@tonic-gate elsif ($_[$i] =~ /^(p|precision)$/) 127*0Sstevel@tonic-gate { 128*0Sstevel@tonic-gate $p = $_[$i+1]; 129*0Sstevel@tonic-gate my $s = 2; $s = 1 if @a-$j < 2; # avoid "can not modify non-existant..." 130*0Sstevel@tonic-gate splice @a, $j, $s; $j -= $s; $i++; 131*0Sstevel@tonic-gate } 132*0Sstevel@tonic-gate elsif ($_[$i] =~ /^(v|version)$/) 133*0Sstevel@tonic-gate { 134*0Sstevel@tonic-gate $ver = 1; 135*0Sstevel@tonic-gate splice @a, $j, 1; $j --; 136*0Sstevel@tonic-gate } 137*0Sstevel@tonic-gate elsif ($_[$i] =~ /^(t|trace)$/) 138*0Sstevel@tonic-gate { 139*0Sstevel@tonic-gate $trace = 1; 140*0Sstevel@tonic-gate splice @a, $j, 1; $j --; 141*0Sstevel@tonic-gate } 142*0Sstevel@tonic-gate else { die "unknown option $_[$i]"; } 143*0Sstevel@tonic-gate } 144*0Sstevel@tonic-gate my $class; 145*0Sstevel@tonic-gate $_lite = 0; # using M::BI::L ? 146*0Sstevel@tonic-gate if ($trace) 147*0Sstevel@tonic-gate { 148*0Sstevel@tonic-gate require Math::BigInt::Trace; $class = 'Math::BigInt::Trace'; 149*0Sstevel@tonic-gate } 150*0Sstevel@tonic-gate else 151*0Sstevel@tonic-gate { 152*0Sstevel@tonic-gate # see if we can find Math::BigInt::Lite 153*0Sstevel@tonic-gate if (!defined $a && !defined $p) # rounding won't work to well 154*0Sstevel@tonic-gate { 155*0Sstevel@tonic-gate eval 'require Math::BigInt::Lite;'; 156*0Sstevel@tonic-gate if ($@ eq '') 157*0Sstevel@tonic-gate { 158*0Sstevel@tonic-gate @import = ( ); # :constant in Lite, not MBI 159*0Sstevel@tonic-gate Math::BigInt::Lite->import( ':constant' ); 160*0Sstevel@tonic-gate $_lite= 1; # signal okay 161*0Sstevel@tonic-gate } 162*0Sstevel@tonic-gate } 163*0Sstevel@tonic-gate require Math::BigInt if $_lite == 0; # not already loaded? 164*0Sstevel@tonic-gate $class = 'Math::BigInt'; # regardless of MBIL or not 165*0Sstevel@tonic-gate } 166*0Sstevel@tonic-gate # Math::BigInt::Trace or plain Math::BigInt 167*0Sstevel@tonic-gate $class->import(@import, lib => $lib); 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate bigint->accuracy($a) if defined $a; 170*0Sstevel@tonic-gate bigint->precision($p) if defined $p; 171*0Sstevel@tonic-gate if ($ver) 172*0Sstevel@tonic-gate { 173*0Sstevel@tonic-gate print "bigint\t\t\t v$VERSION\n"; 174*0Sstevel@tonic-gate print "Math::BigInt::Lite\t v$Math::BigInt::Lite::VERSION\n" if $_lite; 175*0Sstevel@tonic-gate print "Math::BigInt\t\t v$Math::BigInt::VERSION"; 176*0Sstevel@tonic-gate my $config = Math::BigInt->config(); 177*0Sstevel@tonic-gate print " lib => $config->{lib} v$config->{lib_version}\n"; 178*0Sstevel@tonic-gate exit; 179*0Sstevel@tonic-gate } 180*0Sstevel@tonic-gate # we take care of floating point constants, since BigFloat isn't available 181*0Sstevel@tonic-gate # and BigInt doesn't like them: 182*0Sstevel@tonic-gate overload::constant float => sub { Math::BigInt->new( _constant(shift) ); }; 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate $self->export_to_level(1,$self,@a); # export inf and NaN 185*0Sstevel@tonic-gate } 186*0Sstevel@tonic-gate 187*0Sstevel@tonic-gatesub inf () { Math::BigInt->binf(); } 188*0Sstevel@tonic-gatesub NaN () { Math::BigInt->bnan(); } 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate1; 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate__END__ 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate=head1 NAME 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gatebigint - Transparent BigInteger support for Perl 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate=head1 SYNOPSIS 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate use bignt; 201*0Sstevel@tonic-gate 202*0Sstevel@tonic-gate $x = 2 + 4.5,"\n"; # BigInt 6 203*0Sstevel@tonic-gate print 2 ** 512,"\n"; # really is what you think it is 204*0Sstevel@tonic-gate print inf + 42,"\n"; # inf 205*0Sstevel@tonic-gate print NaN * 7,"\n"; # NaN 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate=head1 DESCRIPTION 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gateAll operators (including basic math operations) are overloaded. Integer 210*0Sstevel@tonic-gateconstants are created as proper BigInts. 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gateFloating point constants are truncated to integer. All results are also 213*0Sstevel@tonic-gatetruncated. 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate=head2 OPTIONS 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gatebigint recognizes some options that can be passed while loading it via use. 218*0Sstevel@tonic-gateThe options can (currently) be either a single letter form, or the long form. 219*0Sstevel@tonic-gateThe following options exist: 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate=over 2 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate=item a or accuracy 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gateThis sets the accuracy for all math operations. The argument must be greater 226*0Sstevel@tonic-gatethan or equal to zero. See Math::BigInt's bround() function for details. 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate perl -Mbigint=a,2 -le 'print 12345+1' 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate=item p or precision 231*0Sstevel@tonic-gate 232*0Sstevel@tonic-gateThis sets the precision for all math operations. The argument can be any 233*0Sstevel@tonic-gateinteger. Negative values mean a fixed number of digits after the dot, and 234*0Sstevel@tonic-gateare <B>ignored</B> since all operations happen in integer space. 235*0Sstevel@tonic-gateA positive value rounds to this digit left from the dot. 0 or 1 mean round to 236*0Sstevel@tonic-gateinteger and are ignore like negative values. 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gateSee Math::BigInt's bfround() function for details. 239*0Sstevel@tonic-gate 240*0Sstevel@tonic-gate perl -Mbignum=p,5 -le 'print 123456789+123' 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate=item t or trace 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gateThis enables a trace mode and is primarily for debugging bigint or 245*0Sstevel@tonic-gateMath::BigInt. 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate=item l or lib 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gateLoad a different math lib, see L<MATH LIBRARY>. 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate perl -Mbigint=l,GMP -e 'print 2 ** 512' 252*0Sstevel@tonic-gate 253*0Sstevel@tonic-gateCurrently there is no way to specify more than one library on the command 254*0Sstevel@tonic-gateline. This will be hopefully fixed soon ;) 255*0Sstevel@tonic-gate 256*0Sstevel@tonic-gate=item v or version 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gateThis prints out the name and version of all modules used and then exits. 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate perl -Mbigint=v -e '' 261*0Sstevel@tonic-gate 262*0Sstevel@tonic-gate=head2 MATH LIBRARY 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gateMath with the numbers is done (by default) by a module called 265*0Sstevel@tonic-gateMath::BigInt::Calc. This is equivalent to saying: 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate use bigint lib => 'Calc'; 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gateYou can change this by using: 270*0Sstevel@tonic-gate 271*0Sstevel@tonic-gate use bigint lib => 'BitVect'; 272*0Sstevel@tonic-gate 273*0Sstevel@tonic-gateThe following would first try to find Math::BigInt::Foo, then 274*0Sstevel@tonic-gateMath::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc: 275*0Sstevel@tonic-gate 276*0Sstevel@tonic-gate use bigint lib => 'Foo,Math::BigInt::Bar'; 277*0Sstevel@tonic-gate 278*0Sstevel@tonic-gatePlease see respective module documentation for further details. 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate=head2 INTERNAL FORMAT 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gateThe numbers are stored as objects, and their internals might change at anytime, 283*0Sstevel@tonic-gateespecially between math operations. The objects also might belong to different 284*0Sstevel@tonic-gateclasses, like Math::BigInt, or Math::BigInt::Lite. Mixing them together, even 285*0Sstevel@tonic-gatewith normal scalars is not extraordinary, but normal and expected. 286*0Sstevel@tonic-gate 287*0Sstevel@tonic-gateYou should not depend on the internal format, all accesses must go through 288*0Sstevel@tonic-gateaccessor methods. E.g. looking at $x->{sign} is not a good idea since there 289*0Sstevel@tonic-gateis no guaranty that the object in question has such a hash key, nor is a hash 290*0Sstevel@tonic-gateunderneath at all. 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate=head2 SIGN 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gateThe sign is either '+', '-', 'NaN', '+inf' or '-inf' and stored seperately. 295*0Sstevel@tonic-gateYou can access it with the sign() method. 296*0Sstevel@tonic-gate 297*0Sstevel@tonic-gateA sign of 'NaN' is used to represent the result when input arguments are not 298*0Sstevel@tonic-gatenumbers or as a result of 0/0. '+inf' and '-inf' represent plus respectively 299*0Sstevel@tonic-gateminus infinity. You will get '+inf' when dividing a positive number by 0, and 300*0Sstevel@tonic-gate'-inf' when dividing any negative number by 0. 301*0Sstevel@tonic-gate 302*0Sstevel@tonic-gate=head2 METHODS 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gateSince all numbers are now objects, you can use all functions that are part of 305*0Sstevel@tonic-gatethe BigInt API. You can only use the bxxx() notation, and not the fxxx() 306*0Sstevel@tonic-gatenotation, though. 307*0Sstevel@tonic-gate 308*0Sstevel@tonic-gate=head2 CAVEAT 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gateBut a warning is in order. When using the following to make a copy of a number, 311*0Sstevel@tonic-gateonly a shallow copy will be made. 312*0Sstevel@tonic-gate 313*0Sstevel@tonic-gate $x = 9; $y = $x; 314*0Sstevel@tonic-gate $x = $y = 7; 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gateUsing the copy or the original with overloaded math is okay, e.g. the 317*0Sstevel@tonic-gatefollowing work: 318*0Sstevel@tonic-gate 319*0Sstevel@tonic-gate $x = 9; $y = $x; 320*0Sstevel@tonic-gate print $x + 1, " ", $y,"\n"; # prints 10 9 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gatebut calling any method that modifies the number directly will result in 323*0Sstevel@tonic-gateB<both> the original and the copy beeing destroyed: 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate $x = 9; $y = $x; 326*0Sstevel@tonic-gate print $x->badd(1), " ", $y,"\n"; # prints 10 10 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate $x = 9; $y = $x; 329*0Sstevel@tonic-gate print $x->binc(1), " ", $y,"\n"; # prints 10 10 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gate $x = 9; $y = $x; 332*0Sstevel@tonic-gate print $x->bmul(2), " ", $y,"\n"; # prints 18 18 333*0Sstevel@tonic-gate 334*0Sstevel@tonic-gateUsing methods that do not modify, but testthe contents works: 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gate $x = 9; $y = $x; 337*0Sstevel@tonic-gate $z = 9 if $x->is_zero(); # works fine 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gateSee the documentation about the copy constructor and C<=> in overload, as 340*0Sstevel@tonic-gatewell as the documentation in BigInt for further details. 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate=head1 MODULES USED 343*0Sstevel@tonic-gate 344*0Sstevel@tonic-gateC<bigint> is just a thin wrapper around various modules of the Math::BigInt 345*0Sstevel@tonic-gatefamily. Think of it as the head of the family, who runs the shop, and orders 346*0Sstevel@tonic-gatethe others to do the work. 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gateThe following modules are currently used by bigint: 349*0Sstevel@tonic-gate 350*0Sstevel@tonic-gate Math::BigInt::Lite (for speed, and only if it is loadable) 351*0Sstevel@tonic-gate Math::BigInt 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate=head1 EXAMPLES 354*0Sstevel@tonic-gate 355*0Sstevel@tonic-gateSome cool command line examples to impress the Python crowd ;) You might want 356*0Sstevel@tonic-gateto compare them to the results under -Mbignum or -Mbigrat: 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate perl -Mbigint -le 'print sqrt(33)' 359*0Sstevel@tonic-gate perl -Mbigint -le 'print 2*255' 360*0Sstevel@tonic-gate perl -Mbigint -le 'print 4.5+2*255' 361*0Sstevel@tonic-gate perl -Mbigint -le 'print 3/7 + 5/7 + 8/3' 362*0Sstevel@tonic-gate perl -Mbigint -le 'print 123->is_odd()' 363*0Sstevel@tonic-gate perl -Mbigint -le 'print log(2)' 364*0Sstevel@tonic-gate perl -Mbigint -le 'print 2 ** 0.5' 365*0Sstevel@tonic-gate perl -Mbigint=a,65 -le 'print 2 ** 0.2' 366*0Sstevel@tonic-gate 367*0Sstevel@tonic-gate=head1 LICENSE 368*0Sstevel@tonic-gate 369*0Sstevel@tonic-gateThis program is free software; you may redistribute it and/or modify it under 370*0Sstevel@tonic-gatethe same terms as Perl itself. 371*0Sstevel@tonic-gate 372*0Sstevel@tonic-gate=head1 SEE ALSO 373*0Sstevel@tonic-gate 374*0Sstevel@tonic-gateEspecially L<bigrat> as in C<perl -Mbigrat -le 'print 1/3+1/4'> and 375*0Sstevel@tonic-gateL<bignum> as in C<perl -Mbignum -le 'print sqrt(2)'>. 376*0Sstevel@tonic-gate 377*0Sstevel@tonic-gateL<Math::BigInt>, L<Math::BigRat> and L<Math::Big> as well 378*0Sstevel@tonic-gateas L<Math::BigInt::BitVect>, L<Math::BigInt::Pari> and L<Math::BigInt::GMP>. 379*0Sstevel@tonic-gate 380*0Sstevel@tonic-gate=head1 AUTHORS 381*0Sstevel@tonic-gate 382*0Sstevel@tonic-gate(C) by Tels L<http://bloodgate.com/> in early 2002, 2003. 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate=cut 385