| Previous | Next
bignumSupports whatever big numbers you give it, including large integers and floats. In addition, bignum lets you specify options for the accuracy and precision of numbers that you'll calculate with it. For example: #!/usr/local/bin/perl -w use bignum; my $num1 = 4; my $num2 = 5; my $mult = $num1 * $num2; print sqrt($mult),"\n"; # Yup For a number that would be large, you can use bignum's accuracy option, perl -Mbignum=a,50 -le 'print sqrt(20), "\n";' If you wish to use rounding with bignum, you can use the precision option, perl -Mbignum=p,0 -le 'print sqrt(24), "\n";' # Gives 5 To enable tracing for bignum, use the /usr/local/perl5.8-prerc1/bin/perl5.7.3 -Mbignum=p,0,t -le 'print sqrt(24)' MBI import Math::BigInt::Trace :constant upgrade Math::BigFloat::Trace lib Calc MBF import Math::BigFloat::Trace :constant downgrade Math::BigInt::Trace MBI new '24' => '24' (Math::BigInt::Trace) MBF new '24' => '24' (Math::BigFloat) MBF new '4' => '4' (Math::BigFloat) MBF new '1E-4' => '0' (Math::BigFloat) MBI new '2' => '2' (Math::BigInt::Trace) MBF new '2' => '2' (Math::BigInt::Trace) MBI new '38' => '38' (Math::BigInt::Trace) MBI new '38' => '38' (Math::BigInt::Trace) The perl -Mbignum=l,new_math_lib -e 'print $this ** $that' The |