summaryrefslogtreecommitdiff
path: root/lib/bignum.pm
diff options
context:
space:
mode:
authorTels <nospam-abuse@bloodgate.com>2002-08-14 00:02:09 +0200
committerhv <hv@crypt.org>2002-08-22 22:29:45 +0000
commitb4bc5691c8dfad19b52d103e3b12af9342fcea38 (patch)
tree23ba012d3637ec64db0f0a50ac3477840a8e727b /lib/bignum.pm
parente1e1143f887ddae0f16d3743c74922bf4cc42ade (diff)
downloadperl-b4bc5691c8dfad19b52d103e3b12af9342fcea38.tar.gz
bignum-0.12 updates from:
Subject: [ANNOUCNE] Big Math::Big* update Message-Id: <200208132121.g7DLLRV21408@crypt.org> p4raw-id: //depot/perl@17758
Diffstat (limited to 'lib/bignum.pm')
-rw-r--r--lib/bignum.pm38
1 files changed, 34 insertions, 4 deletions
diff --git a/lib/bignum.pm b/lib/bignum.pm
index c900c95ea2..235f9d6a64 100644
--- a/lib/bignum.pm
+++ b/lib/bignum.pm
@@ -1,10 +1,11 @@
package bignum;
require 5.005;
-$VERSION = '0.11';
+$VERSION = '0.12';
use Exporter;
-@ISA = qw( Exporter );
-@EXPORT_OK = qw( );
+@EXPORT_OK = qw( );
+@EXPORT = qw( inf NaN );
+@ISA = qw( Exporter );
use strict;
@@ -166,8 +167,12 @@ sub import
print "Math::BigFloat\t\t v$Math::BigFloat::VERSION\n";
exit;
}
+ $self->export_to_level(1,$self,@a); # export inf and NaN
}
+sub inf () { Math::BigInt->binf(); }
+sub NaN () { Math::BigInt->bnan(); }
+
1;
__END__
@@ -181,7 +186,9 @@ bignum - Transparent BigNumber support for Perl
use bignum;
$x = 2 + 4.5,"\n"; # BigFloat 6.5
- print 2 ** 512 * 0.1; # really is what you think it is
+ print 2 ** 512 * 0.1,"\n"; # really is what you think it is
+ print inf * inf,"\n"; # prints inf
+ print NaN * 3,"\n"; # prints NaN
=head1 DESCRIPTION
@@ -233,6 +240,29 @@ This prints out the name and version of all modules used and then exits.
perl -Mbignum=v -e ''
+=head2 METHODS
+
+Beside import() and AUTOLOAD() there are only a few other methods.
+
+=over 2
+
+=item inf()
+
+A shortcut to return Math::BigInt->binf(). Usefull because Perl does not always
+handle bareword C<inf> properly.
+
+=item NaN()
+
+A shortcut to return Math::BigInt->bnan(). Usefull because Perl does not always
+handle bareword C<NaN> properly.
+
+=item upgrade()
+
+Return the class that numbers are upgraded to, is in fact returning
+C<$Math::BigInt::upgrade>.
+
+=back
+
=head2 MATH LIBRARY
Math with the numbers is done (by default) by a module called