start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

8.28. bigrat

Implements big rational support for Perl. For example, if you want to add the fractions 1/2 + 3/8, you can use bigrat to calculate the result and display it in fractional form: 7/8. Or in Perl terms:

#!/usr/local/bin/perl -w
use bigrat;
 
my $frac1 = 1/2;
my $frac2 = 3/8;
print $frac1 + $frac2, "\n"; # Prints 7/8

As of Perl 5.8, bigrat is shipped with the Perl source kit.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.