source:
trunk/essentials/dev-lang/perl/lib/bigrat.pm@
3310
| Last change on this file since 3310 was 3181, checked in by , 19 years ago | |
|---|---|
| File size: 9.2 KB | |
| Line | |
|---|---|
| 1 | package bigrat; |
| 2 | require 5.005; |
| 3 | |
| 4 | $VERSION = '0.08'; |
| 5 | require Exporter; |
| 6 | @ISA = qw( Exporter ); |
| 7 | @EXPORT_OK = qw( ); |
| 8 | @EXPORT = qw( inf NaN ); |
| 9 | |
| 10 | use strict; |
| 11 | |
| 12 | ############################################################################## |
| 13 | |
| 14 | # These are all alike, and thus faked by AUTOLOAD |
| 15 | |
| 16 | my @faked = qw/round_mode accuracy precision div_scale/; |
| 17 | use vars qw/$VERSION $AUTOLOAD $_lite/; # _lite for testsuite |
| 18 | |
| 19 | sub AUTOLOAD |
| 20 | { |
| 21 | my $name = $AUTOLOAD; |
| 22 | |
| 23 | $name =~ s/.*:://; # split package |
| 24 | no strict 'refs'; |
| 25 | foreach my $n (@faked) |
| 26 | { |
| 27 | if ($n eq $name) |
| 28 | { |
| 29 | *{"bigrat::$name"} = sub |
| 30 | { |
| 31 | my $self = shift; |
| 32 | no strict 'refs'; |
| 33 | if (defined $_[0]) |
| 34 | { |
| 35 | Math::BigInt->$name($_[0]); |
