diff options
author | Tels <nospam-abuse@bloodgate.com> | 2002-08-14 00:02:09 +0200 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-08-22 22:29:45 +0000 |
commit | b4bc5691c8dfad19b52d103e3b12af9342fcea38 (patch) | |
tree | 23ba012d3637ec64db0f0a50ac3477840a8e727b /lib/bignum | |
parent | e1e1143f887ddae0f16d3743c74922bf4cc42ade (diff) | |
download | perl-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')
-rwxr-xr-x | lib/bignum/t/bignum.t | 2 | ||||
-rw-r--r-- | lib/bignum/t/biinfnan.t | 21 | ||||
-rw-r--r-- | lib/bignum/t/bn_lite.t | 30 | ||||
-rw-r--r-- | lib/bignum/t/bninfnan.t | 21 | ||||
-rw-r--r-- | lib/bignum/t/br_lite.t | 30 | ||||
-rw-r--r-- | lib/bignum/t/brinfnan.t | 21 | ||||
-rw-r--r-- | lib/bignum/t/infnan.inc | 35 |
7 files changed, 160 insertions, 0 deletions
diff --git a/lib/bignum/t/bignum.t b/lib/bignum/t/bignum.t index 32235ea2d5..21a70e39dc 100755 --- a/lib/bignum/t/bignum.t +++ b/lib/bignum/t/bignum.t @@ -35,6 +35,8 @@ ok (2/3,"0.6666666666666666666666666666666666666667"); #ok (2 ** 0.5, 'NaN'); # should be sqrt(2); +print "huh\n"; + ok (12->bfac(),479001600); # see if Math::BigFloat constant works diff --git a/lib/bignum/t/biinfnan.t b/lib/bignum/t/biinfnan.t new file mode 100644 index 0000000000..84d3a71bfa --- /dev/null +++ b/lib/bignum/t/biinfnan.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w + +############################################################################### + +use Test; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + plan tests => 26; + } + +use bigint; + +my ($x); + +require "infnan.inc"; + diff --git a/lib/bignum/t/bn_lite.t b/lib/bignum/t/bn_lite.t new file mode 100644 index 0000000000..21247c1ee7 --- /dev/null +++ b/lib/bignum/t/bn_lite.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w + +############################################################################### + +use Test; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + plan tests => 1; + } + +eval 'require Math::BigInt::Lite;'; +if ($@ eq '') + { + # can use Lite, so let bignum try it + require bignum; bignum->import(); + # can't get to work a ref(1+1) here, presumable because :constant phase + # already done + ok ($bignum::_lite,1); + } +else + { + print "ok 1 # skipped, no Math::BigInt::Lite\n"; + } + + diff --git a/lib/bignum/t/bninfnan.t b/lib/bignum/t/bninfnan.t new file mode 100644 index 0000000000..d097215b9e --- /dev/null +++ b/lib/bignum/t/bninfnan.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w + +############################################################################### + +use Test; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + plan tests => 26; + } + +use bignum; + +my ($x); + +require "infnan.inc"; + diff --git a/lib/bignum/t/br_lite.t b/lib/bignum/t/br_lite.t new file mode 100644 index 0000000000..2bf77d4037 --- /dev/null +++ b/lib/bignum/t/br_lite.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w + +############################################################################### + +use Test; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + plan tests => 1; + } + +eval 'require Math::BigInt::Lite;'; +if ($@ eq '') + { + # can use Lite, so let bignum try it + require bigrat; bigrat->import(); + # can't get to work a ref(1+1) here, presumable because :constant phase + # already done + ok ($bigrat::_lite,1); + } +else + { + print "ok 1 # skipped, no Math::BigInt::Lite\n"; + } + + diff --git a/lib/bignum/t/brinfnan.t b/lib/bignum/t/brinfnan.t new file mode 100644 index 0000000000..689a855698 --- /dev/null +++ b/lib/bignum/t/brinfnan.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w + +############################################################################### + +use Test; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + plan tests => 26; + } + +use bigrat; + +my ($x); + +require "infnan.inc"; + diff --git a/lib/bignum/t/infnan.inc b/lib/bignum/t/infnan.inc new file mode 100644 index 0000000000..771b94e748 --- /dev/null +++ b/lib/bignum/t/infnan.inc @@ -0,0 +1,35 @@ + +use strict; + +my ($x); + +############################################################################### +# inf tests + +$x = 1+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf'); +$x = 1*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf'); + +# these don't work without exporting inf() +$x = inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf'); +$x = inf+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf'); +$x = inf*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf'); + +############################################################################### +# NaN tests + +$x = 1+NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); +$x = 1*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); + +# these don't work without exporting NaN() +$x = NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); +$x = NaN+NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); +$x = NaN*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); + +############################################################################### +# mixed tests + +# these don't work without exporting NaN() or inf() +$x = NaN+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); +$x = NaN*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); +$x = inf*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN'); + |