Math::BigRat package arbitrary big rational numbers.
SYNOPSIS
use Math::BigRat;
my $x = Math::BigRat->new('3/7'); $x += '5/9';
print $x->bstr(),"n";
print $x ** 2,"n";
my $y = Math::BigRat->new('inf');
print "$y ", ($y->is_inf ? 'is' : 'is not') , " infinityn";
my $z = Math::BigRat->new(144); $z->bsqrt();
Math::BigRat complements Math::BigInt and Math::BigFloat by providing support for arbitrary big rational numbers.
MATH LIBRARY
You can change the underlying module that does the low-level math operations by using:
use Math::BigRat try => 'GMP';
Note: This needs Math::BigInt::GMP installed.
The following would first try to find Math::BigInt::Foo, then Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc:
use Math::BigRat try => 'Foo,Math::BigInt::Bar';
If you want to get warned when the fallback occurs, replace "try" with "lib":
use Math::BigRat lib => 'Foo,Math::BigInt::Bar';
If you want the code to die instead, replace "try" with "only":
use Math::BigRat only => 'Foo,Math::BigInt::Bar';
Product's homepage
Requirements:
· Perl