diff options
Diffstat (limited to 'cpan/Math-BigInt/t')
69 files changed, 701 insertions, 12876 deletions
diff --git a/cpan/Math-BigInt/t/_bin_parts_to_lib_parts.t b/cpan/Math-BigInt/t/_bin_parts_to_lib_parts.t deleted file mode 100644 index 67edea9bf3..0000000000 --- a/cpan/Math-BigInt/t/_bin_parts_to_lib_parts.t +++ /dev/null @@ -1,88 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 36; - -use Math::BigInt; - -my $LIB = Math::BigInt -> config('lib'); - -sub try { - my ($in0, $in1, $in2, $in3, $in4, $out0, $out1, $out2, $out3) = @_; - - my @out; - my $test = q|@out = Math::BigInt -> _bin_parts_to_lib_parts| - . qq|("$in0", "$in1", "$in2", "$in3", $in4)|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test => sub { - plan tests => 5; - - is(scalar(@out), 4, 'number of output arguments'); - is($out[0], $out0, 'sign of the significand'); - is($LIB -> _str($out[1]), $out1, 'absolute value of the significand'); - is($out[2], $out2, 'sign of the exponent'); - is($LIB -> _str($out[3]), $out3, 'absolute value of the exponent'); - }; -} - -note("binary"); - -try qw< + 0 + 0 >, 1, qw< + 0 + 0 >; -try qw< + 00.000 - 0000 >, 1, qw< + 0 + 0 >; - -try qw< + 1010 + 0 >, 1, qw< + 1 + 1 >; -try qw< + 1111 + 0 >, 1, qw< + 15 + 0 >; -try qw< + 0.1 + 0 >, 1, qw< + 5 - 1 >; - -try qw< + 10 - 8 >, 1, qw< + 78125 - 7 >; -try qw< + 10 + 8 >, 1, qw< + 512 + 0 >; - -try qw< + 11000000001100 - 0 >, 1, qw< + 123 + 2 >; -try qw< + 1100000000110000 - 2 >, 1, qw< + 123 + 2 >; - -try qw< + .00110011 + 5 >, 1, qw< + 6375 - 3 >; - -try qw< - 1100.0011 + 2 >, 1, qw< - 4875 - 2 >; - -note("octal"); - -try qw< + 0 + 0 >, 3, qw< + 0 + 0 >; -try qw< + 00.000 - 0000 >, 3, qw< + 0 + 0 >; -try qw< + 12 + 0 >, 3, qw< + 1 + 1 >; -try qw< + 17 + 0 >, 3, qw< + 15 + 0 >; -try qw< + 0.4 + 0 >, 3, qw< + 5 - 1 >; -try qw< + 2 - 8 >, 3, qw< + 78125 - 7 >; -try qw< + 2 + 8 >, 3, qw< + 512 + 0 >; -try qw< + 30014 - 0 >, 3, qw< + 123 + 2 >; -try qw< + 14006 + 1 >, 3, qw< + 123 + 2 >; -try qw< + 12300 + 0 >, 3, qw< + 5312 + 0 >; - -note("hexadecimal"); - -try qw< + 0 + 0 >, 4, qw< + 0 + 0 >; -try qw< + 00.000 - 0000 >, 4, qw< + 0 + 0 >; - -try qw< + a + 0 >, 4, qw< + 1 + 1 >; -try qw< + f + 0 >, 4, qw< + 15 + 0 >; -try qw< + 0.8 + 0 >, 4, qw< + 5 - 1 >; - -try qw< + 2 - 8 >, 4, qw< + 78125 - 7 >; -try qw< + 2 + 8 >, 4, qw< + 512 + 0 >; - -try qw< + 300c - 0 >, 4, qw< + 123 + 2 >; -try qw< + 1.806 + 13 >, 4, qw< + 123 + 2 >; -try qw< + c030 - 2 >, 4, qw< + 123 + 2 >; - -try qw< + 0.0625 + 16 >, 4, qw< + 1573 + 0 >; - -try qw< + .0123 + 0 >, 4, qw< + 44403076171875 - 16 >; -try qw< + 12300 + 0 >, 4, qw< + 74496 + 0 >; - -try qw< + .00120034 + 5 >, 4, qw< + 87894499301910400390625 - 25 >; - -try qw< - 1200.0034 + 2 >, 4, qw< - 18432003173828125 - 12 >; diff --git a/cpan/Math-BigInt/t/_bin_str_to_str_parts.t b/cpan/Math-BigInt/t/_bin_str_to_str_parts.t deleted file mode 100644 index f8faa76fc9..0000000000 --- a/cpan/Math-BigInt/t/_bin_str_to_str_parts.t +++ /dev/null @@ -1,58 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 18; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0, $out1, $out2, $out3) = split /:/; - my ($ss, $sa, $es, $ea); - - my $test = q|($ss, $sa, $es, $ea) = | - . qq|Math::BigInt -> _bin_str_to_str_parts("$in0")|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test => sub { - plan tests => 4; - is($ss, $out0, 'sign of the significand'); - is($sa, $out1, 'absolute value of the significand'); - is($es, $out2, 'sign of the exponent'); - is($ea, $out3, 'absolute value of the exponent'); - }; -} - -__DATA__ - -0:+:0:+:0 -0p-0:+:0:+:0 -0p-7:+:0:+:0 -0p+7:+:0:+:0 - -0.0110:+:.011:+:0 -0110.0:+:110:+:0 -0110.0110:+:110.011:+:0 - -0b1.p0:+:1:+:0 - -00.0011001100P0056007800:+:.00110011:+:56007800 - -+1__1__.__1__1__p+5__6__:+:11.11:+:56 -+1__1__.__1__1__p-5__6__:+:11.11:-:56 --1__1__.__1__1__p+5__6__:-:11.11:+:56 --1__1__.__1__1__p-5__6__:-:11.11:-:56 - -1__1__.__1__1__p5__6__:+:11.11:+:56 -1__1__.__1__1__p-5__6__:+:11.11:-:56 --1__1__.__1__1__p5__6__:-:11.11:+:56 - --0b__1__1__.__1__1__p-1__1__:-:11.11:-:11 --0B__1__1__.__1__1__P-1__1__:-:11.11:-:11 diff --git a/cpan/Math-BigInt/t/_dec_parts_to_lib_parts.t b/cpan/Math-BigInt/t/_dec_parts_to_lib_parts.t deleted file mode 100644 index dd4f4a4137..0000000000 --- a/cpan/Math-BigInt/t/_dec_parts_to_lib_parts.t +++ /dev/null @@ -1,69 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 30; - -use Math::BigInt; - -my $LIB = Math::BigInt -> config('lib'); - -sub try { - my ($in0, $in1, $in2, $in3, $out0, $out1, $out2, $out3) = @_; - - my @out; - my $test = q|@out = Math::BigInt -> _dec_parts_to_lib_parts| - . qq|("$in0", "$in1", "$in2", "$in3")|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test => sub { - plan tests => 5; - - is(scalar(@out), 4, 'number of output arguments'); - is($out[0], $out0, 'sign of the significand'); - is($LIB -> _str($out[1]), $out1, 'absolute value of the significand'); - is($out[2], $out2, 'sign of the exponent'); - is($LIB -> _str($out[3]), $out3, 'absolute value of the exponent'); - }; -} - -try qw< + 0 + 0 >, qw< + 0 + 0 >; -try qw< + 00.000 - 0000 >, qw< + 0 + 0 >; - -try qw< + 0.01230 + 5 >, qw< + 123 + 1 >; -try qw< + 0.1230 + 5 >, qw< + 123 + 2 >; -try qw< + 1.230 + 5 >, qw< + 123 + 3 >; -try qw< + 12.30 + 5 >, qw< + 123 + 4 >; -try qw< + 123.0 + 5 >, qw< + 123 + 5 >; -try qw< + 1230.0 + 5 >, qw< + 123 + 6 >; - -try qw< + 0.01230 + 2 >, qw< + 123 - 2 >; -try qw< + 0.1230 + 2 >, qw< + 123 - 1 >; -try qw< + 1.230 + 2 >, qw< + 123 + 0 >; -try qw< + 12.30 + 2 >, qw< + 123 + 1 >; -try qw< + 123.0 + 2 >, qw< + 123 + 2 >; -try qw< + 1230.0 + 2 >, qw< + 123 + 3 >; - -try qw< + 0.01230 - 2 >, qw< + 123 - 6 >; -try qw< + 0.1230 - 2 >, qw< + 123 - 5 >; -try qw< + 1.230 - 2 >, qw< + 123 - 4 >; -try qw< + 12.30 - 2 >, qw< + 123 - 3 >; -try qw< + 123.0 - 2 >, qw< + 123 - 2 >; -try qw< + 1230.0 - 2 >, qw< + 123 - 1 >; - -try qw< + 0.01230 - 4 >, qw< + 123 - 8 >; -try qw< + 0.1230 - 4 >, qw< + 123 - 7 >; -try qw< + 1.230 - 4 >, qw< + 123 - 6 >; -try qw< + 12.30 - 4 >, qw< + 123 - 5 >; -try qw< + 123.0 - 4 >, qw< + 123 - 4 >; -try qw< + 1230.0 - 4 >, qw< + 123 - 3 >; - -try qw< + .0123 + 0 >, qw< + 123 - 4 >; -try qw< + 12300 + 0 >, qw< + 123 + 2 >; - -try qw< + .00120034 + 5 >, qw< + 120034 - 3 >; - -try qw< - 1200.0034 + 2 >, qw< - 12000034 - 2 >; diff --git a/cpan/Math-BigInt/t/_dec_str_to_str_parts.t b/cpan/Math-BigInt/t/_dec_str_to_str_parts.t deleted file mode 100644 index d94d8cd464..0000000000 --- a/cpan/Math-BigInt/t/_dec_str_to_str_parts.t +++ /dev/null @@ -1,57 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 16; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0, $out1, $out2, $out3) = split /:/; - my ($ss, $sa, $es, $ea); - - my $test = q|($ss, $sa, $es, $ea) = | - . qq|Math::BigInt -> _dec_str_to_str_parts("$in0")|; - - eval $test; - die $@ if $@; # this should never happen - - - - subtest $test => sub { - plan tests => 4; - is($ss, $out0, 'sign of the significand'); - is($sa, $out1, 'absolute value of the significand'); - is($es, $out2, 'sign of the exponent'); - is($ea, $out3, 'absolute value of the exponent'); - }; -} - -__DATA__ - -0:+:0:+:0 -0e-0:+:0:+:0 -0e-7:+:0:+:0 -0e+7:+:0:+:0 - -0.0120:+:.012:+:0 -0120.0:+:120:+:0 -0120.0340:+:120.034:+:0 - -1.e0:+:1:+:0 - -00.0012003400E0056007800:+:.00120034:+:56007800 - -+1__2__.__3__4__e+5__6__:+:12.34:+:56 -+1__2__.__3__4__e-5__6__:+:12.34:-:56 --1__2__.__3__4__e+5__6__:-:12.34:+:56 --1__2__.__3__4__e-5__6__:-:12.34:-:56 - -1__2__.__3__4__e5__6__:+:12.34:+:56 -1__2__.__3__4__e-5__6__:+:12.34:-:56 --1__2__.__3__4__e5__6__:-:12.34:+:56 diff --git a/cpan/Math-BigInt/t/_e_math.t b/cpan/Math-BigInt/t/_e_math.t deleted file mode 100644 index 3cf917bb01..0000000000 --- a/cpan/Math-BigInt/t/_e_math.t +++ /dev/null @@ -1,116 +0,0 @@ -# -*- mode: perl; -*- - -# test the helper math routines in Math::BigFloat - -use strict; -use warnings; - -use Test::More tests => 26; - -use Math::BigFloat lib => 'Calc'; - -############################################################################# -# add - -{ - my $a = Math::BigInt::Calc->_new("123"); - my $b = Math::BigInt::Calc->_new("321"); - - test_add(123, 321, '+', '+'); - test_add(123, 321, '+', '-'); - test_add(123, 321, '-', '+'); - - test_add(321, 123, '-', '+'); - test_add(321, 123, '+', '-'); - - test_add(10, 1, '+', '-'); - test_add(10, 1, '-', '+'); - test_add( 1, 10, '-', '+'); - - SKIP: { - skip q|$x -> _zero() does not (yet?) modify the first argument|, 2; - - test_add(123, 123, '-', '+'); - test_add(123, 123, '+', '-'); - } - - test_add(123, 123, '+', '+'); - test_add(123, 123, '-', '-'); - - test_add(0, 0, '-', '+'); - test_add(0, 0, '+', '-'); - test_add(0, 0, '+', '+'); - test_add(0, 0, '-', '-'); # gives "-0"! TODO: fix this! -} - -############################################################################# -# sub - -{ - my $a = Math::BigInt::Calc->_new("123"); - my $b = Math::BigInt::Calc->_new("321"); - - test_sub(123, 321, '+', '-'); - test_sub(123, 321, '-', '+'); - - test_sub(123, 123, '-', '+'); - test_sub(123, 123, '+', '-'); - - SKIP: { - skip q|$x -> _zero() does not (yet?) modify the first argument|, 2; - - test_sub(123, 123, '+', '+'); - test_sub(123, 123, '-', '-'); - } - - test_sub(0, 0, '-', '+'); # gives "-0"! TODO: fix this! - test_sub(0, 0, '+', '-'); - test_sub(0, 0, '+', '+'); - test_sub(0, 0, '-', '-'); -} - -############################################################################### - -sub test_add { - my ($a, $b, $as, $bs) = @_; - - my $aa = Math::BigInt::Calc -> _new($a); - my $bb = Math::BigInt::Calc -> _new($b); - my ($x, $xs) = Math::BigFloat::_e_add($aa, $bb, "$as", "$bs"); - my $got = $xs . Math::BigInt::Calc->_str($x); - - my $expected = sprintf("%+d", "$as$a" + "$bs$b"); - - subtest qq|Math::BigFloat::_e_add($a, $b, "$as", "$bs");| - => sub { - plan tests => 2; - - is($got, $expected, 'output has the correct value'); - is(Math::BigInt::Calc->_str($x), - Math::BigInt::Calc->_str($aa), - 'first operand to _e_add() is modified' - ); - }; -} - -sub test_sub { - my ($a, $b, $as, $bs) = @_; - - my $aa = Math::BigInt::Calc -> _new($a); - my $bb = Math::BigInt::Calc -> _new($b); - my ($x, $xs) = Math::BigFloat::_e_sub($aa, $bb, "$as", "$bs"); - my $got = $xs . Math::BigInt::Calc->_str($x); - - my $expected = sprintf("%+d", "$as$a" - "$bs$b"); - - subtest qq|Math::BigFloat::_e_sub($a, $b, "$as", "$bs");| - => sub { - plan tests => 2; - - is($got, $expected, 'output has the correct value'); - is(Math::BigInt::Calc->_str($x), - Math::BigInt::Calc->_str($aa), - 'first operand to _e_sub() is modified' - ); - }; -} diff --git a/cpan/Math-BigInt/t/_hex_str_to_str_parts.t b/cpan/Math-BigInt/t/_hex_str_to_str_parts.t deleted file mode 100644 index 02bdd1345a..0000000000 --- a/cpan/Math-BigInt/t/_hex_str_to_str_parts.t +++ /dev/null @@ -1,58 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 18; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0, $out1, $out2, $out3) = split /:/; - my ($ss, $sa, $es, $ea); - - my $test = q|($ss, $sa, $es, $ea) = | - . qq|Math::BigInt -> _hex_str_to_str_parts("$in0")|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test => sub { - plan tests => 4; - is($ss, $out0, 'sign of the significand'); - is($sa, $out1, 'absolute value of the significand'); - is($es, $out2, 'sign of the exponent'); - is($ea, $out3, 'absolute value of the exponent'); - }; -} - -__DATA__ - -0:+:0:+:0 -0p-0:+:0:+:0 -0p-7:+:0:+:0 -0p+7:+:0:+:0 - -0.0120:+:.012:+:0 -0120.0:+:120:+:0 -0120.0340:+:120.034:+:0 - -0x1.p0:+:1:+:0 - -00.0012003400P0056007800:+:.00120034:+:56007800 - -+1__2__.__3__4__p+5__6__:+:12.34:+:56 -+1__2__.__3__4__p-5__6__:+:12.34:-:56 --1__2__.__3__4__p+5__6__:-:12.34:+:56 --1__2__.__3__4__p-5__6__:-:12.34:-:56 - -1__2__.__3__4__p5__6__:+:12.34:+:56 -1__2__.__3__4__p-5__6__:+:12.34:-:56 --1__2__.__3__4__p5__6__:-:12.34:+:56 - --0x__a__b__.__c__d__p-1__2__:-:ab.cd:-:12 --0X__A__B__.__C__D__P-1__2__:-:AB.CD:-:12 diff --git a/cpan/Math-BigInt/t/_oct_str_to_str_parts.t b/cpan/Math-BigInt/t/_oct_str_to_str_parts.t deleted file mode 100644 index c6431f261c..0000000000 --- a/cpan/Math-BigInt/t/_oct_str_to_str_parts.t +++ /dev/null @@ -1,58 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 18; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0, $out1, $out2, $out3) = split /:/; - my ($ss, $sa, $es, $ea); - - my $test = q|($ss, $sa, $es, $ea) = | - . qq|Math::BigInt -> _oct_str_to_str_parts("$in0")|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test => sub { - plan tests => 4; - is($ss, $out0, 'sign of the significand'); - is($sa, $out1, 'absolute value of the significand'); - is($es, $out2, 'sign of the exponent'); - is($ea, $out3, 'absolute value of the exponent'); - }; -} - -__DATA__ - -0:+:0:+:0 -0p-0:+:0:+:0 -0p-7:+:0:+:0 -0p+7:+:0:+:0 - -0.0120:+:.012:+:0 -0120.0:+:120:+:0 -0120.0340:+:120.034:+:0 - -01.p0:+:1:+:0 - -00.0012003400P0056007800:+:.00120034:+:56007800 - -+0__1__2__.__3__4__p+5__6__:+:12.34:+:56 -+0__1__2__.__3__4__p-5__6__:+:12.34:-:56 --0__1__2__.__3__4__p+5__6__:-:12.34:+:56 --0__1__2__.__3__4__p-5__6__:-:12.34:-:56 - -01__2__.__3__4__p5__6__:+:12.34:+:56 -1__2__.__3__4__p-5__6__:+:12.34:-:56 --1__2__.__3__4__p5__6__:-:12.34:+:56 - --0o__1__2__.__3__4__p-5__6__:-:12.34:-:56 --0O__1__2__.__3__4__P-5__6__:-:12.34:-:56 diff --git a/cpan/Math-BigInt/t/backermann-mbi.t b/cpan/Math-BigInt/t/backermann-mbi.t deleted file mode 100644 index cc32dd1df0..0000000000 --- a/cpan/Math-BigInt/t/backermann-mbi.t +++ /dev/null @@ -1,507 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 858; - -my $class; - -BEGIN { - $class = 'Math::BigInt'; - use_ok($class); -} - -can_ok($class, 'backermann', 'ackermann'); - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($m, $n, $expected) = split /:/; - - # backermann() modifies the invocand. - - { - my ($x, $y); - my $test = qq|\$x = $class->new("$m"); \$y = \$x->backermann("$n");|; - - subtest $test, - sub { - plan tests => 4; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - is(ref($y), $class, - "'$test' output arg is a $class"); - - is($y -> bstr(), $expected, - "'$test' output arg has the right value"); - - is($x -> bstr(), $expected, - "'$test' invocand has the right value"); - }; - } - - # ackermann() does not modify the invocand. - - { - my ($x, $y); - my $test = qq|\$x = $class->new("$m"); \$y = \$x->ackermann("$n");|; - - subtest $test, - sub { - plan tests => 4; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - is(ref($y), $class, - "'$test' output arg is a $class"); - - is($y -> bstr(), $expected, - "'$test' output arg has the right value"); - - is($x -> bstr(), $m, - "'$test' invocand has the right value"); - }; - } -} - -__DATA__ - -0:0:1 -0:1:2 -0:2:3 -0:3:4 -0:4:5 -0:5:6 -0:6:7 -0:7:8 -0:8:9 -0:9:10 -0:10:11 -0:11:12 -0:12:13 -0:13:14 -0:14:15 -0:15:16 -0:16:17 -0:17:18 -0:18:19 -0:19:20 -0:20:21 -0:21:22 -0:22:23 -0:23:24 -0:24:25 -0:25:26 -0:26:27 -0:27:28 -0:28:29 -0:29:30 -0:30:31 -0:31:32 -0:32:33 -0:33:34 -0:34:35 -0:35:36 -0:36:37 -0:37:38 -0:38:39 -0:39:40 -0:40:41 -0:41:42 -0:42:43 -0:43:44 -0:44:45 -0:45:46 -0:46:47 -0:47:48 -0:48:49 -0:49:50 -0:50:51 -0:51:52 -0:52:53 -0:53:54 -0:54:55 -0:55:56 -0:56:57 -0:57:58 -0:58:59 -0:59:60 -0:60:61 -0:61:62 -0:62:63 -0:63:64 -0:64:65 -0:65:66 -0:66:67 -0:67:68 -0:68:69 -0:69:70 -0:70:71 -0:71:72 -0:72:73 -0:73:74 -0:74:75 -0:75:76 -0:76:77 -0:77:78 -0:78:79 -0:79:80 -0:80:81 -0:81:82 -0:82:83 -0:83:84 -0:84:85 -0:85:86 -0:86:87 -0:87:88 -0:88:89 -0:89:90 -0:90:91 -0:91:92 -0:92:93 -0:93:94 -0:94:95 -0:95:96 -0:96:97 -0:97:98 -0:98:99 -0:99:100 -0:100:101 -0:1000:1001 -0:100000:100001 -0:10000000:10000001 -0:10000000000:10000000001 -0:10000000000000:10000000000001 -0:10000000000000000000000000000000000:10000000000000000000000000000000001 -0:12345678987654321012345678987654321:12345678987654321012345678987654322 - -1:0:2 -1:1:3 -1:2:4 -1:3:5 -1:4:6 -1:5:7 -1:6:8 -1:7:9 -1:8:10 -1:9:11 -1:10:12 -1:11:13 -1:12:14 -1:13:15 -1:14:16 -1:15:17 -1:16:18 -1:17:19 -1:18:20 -1:19:21 -1:20:22 -1:21:23 -1:22:24 -1:23:25 -1:24:26 -1:25:27 -1:26:28 -1:27:29 -1:28:30 -1:29:31 -1:30:32 -1:31:33 -1:32:34 -1:33:35 -1:34:36 -1:35:37 -1:36:38 -1:37:39 -1:38:40 -1:39:41 -1:40:42 -1:41:43 -1:42:44 -1:43:45 -1:44:46 -1:45:47 -1:46:48 -1:47:49 -1:48:50 -1:49:51 -1:50:52 -1:51:53 -1:52:54 -1:53:55 -1:54:56 -1:55:57 -1:56:58 -1:57:59 -1:58:60 -1:59:61 -1:60:62 -1:61:63 -1:62:64 -1:63:65 -1:64:66 -1:65:67 -1:66:68 -1:67:69 -1:68:70 -1:69:71 -1:70:72 -1:71:73 -1:72:74 -1:73:75 -1:74:76 -1:75:77 -1:76:78 -1:77:79 -1:78:80 -1:79:81 -1:80:82 -1:81:83 -1:82:84 -1:83:85 -1:84:86 -1:85:87 -1:86:88 -1:87:89 -1:88:90 -1:89:91 -1:90:92 -1:91:93 -1:92:94 -1:93:95 -1:94:96 -1:95:97 -1:96:98 -1:97:99 -1:98:100 -1:99:101 -1:100:102 -1:1000:1002 -1:100000:100002 -1:10000000:10000002 -1:10000000000:10000000002 -1:10000000000000:10000000000002 -1:10000000000000000000000000000000000:10000000000000000000000000000000002 -1:12345678987654321012345678987654321:12345678987654321012345678987654323 - -2:0:3 -2:1:5 -2:2:7 -2:3:9 -2:4:11 -2:5:13 -2:6:15 -2:7:17 -2:8:19 -2:9:21 -2:10:23 -2:11:25 -2:12:27 -2:13:29 -2:14:31 -2:15:33 -2:16:35 -2:17:37 -2:18:39 -2:19:41 -2:20:43 -2:21:45 -2:22:47 -2:23:49 -2:24:51 -2:25:53 -2:26:55 -2:27:57 -2:28:59 -2:29:61 -2:30:63 -2:31:65 -2:32:67 -2:33:69 -2:34:71 -2:35:73 -2:36:75 -2:37:77 -2:38:79 -2:39:81 -2:40:83 -2:41:85 -2:42:87 -2:43:89 -2:44:91 -2:45:93 -2:46:95 -2:47:97 -2:48:99 -2:49:101 -2:50:103 -2:51:105 -2:52:107 -2:53:109 -2:54:111 -2:55:113 -2:56:115 -2:57:117 -2:58:119 -2:59:121 -2:60:123 -2:61:125 -2:62:127 -2:63:129 -2:64:131 -2:65:133 -2:66:135 -2:67:137 -2:68:139 -2:69:141 -2:70:143 -2:71:145 -2:72:147 -2:73:149 -2:74:151 -2:75:153 -2:76:155 -2:77:157 -2:78:159 -2:79:161 -2:80:163 -2:81:165 -2:82:167 -2:83:169 -2:84:171 -2:85:173 -2:86:175 -2:87:177 -2:88:179 -2:89:181 -2:90:183 -2:91:185 -2:92:187 -2:93:189 -2:94:191 -2:95:193 -2:96:195 -2:97:197 -2:98:199 -2:99:201 -2:100:203 -2:1000:2003 -2:100000:200003 -2:10000000:20000003 -2:10000000000:20000000003 -2:10000000000000:20000000000003 -2:10000000000000000000000000000000000:20000000000000000000000000000000003 -2:12345678987654321012345678987654321:24691357975308642024691357975308645 - -3:0:5 -3:1:13 -3:2:29 -3:3:61 -3:4:125 -3:5:253 -3:6:509 -3:7:1021 -3:8:2045 -3:9:4093 -3:10:8189 -3:11:16381 -3:12:32765 -3:13:65533 -3:14:131069 -3:15:262141 -3:16:524285 -3:17:1048573 -3:18:2097149 -3:19:4194301 -3:20:8388605 -3:21:16777213 -3:22:33554429 -3:23:67108861 -3:24:134217725 -3:25:268435453 -3:26:536870909 -3:27:1073741821 -3:28:2147483645 -3:29:4294967293 -3:30:8589934589 -3:31:17179869181 -3:32:34359738365 -3:33:68719476733 -3:34:137438953469 -3:35:274877906941 -3:36:549755813885 -3:37:1099511627773 -3:38:2199023255549 -3:39:4398046511101 -3:40:8796093022205 -3:41:17592186044413 -3:42:35184372088829 -3:43:70368744177661 -3:44:140737488355325 -3:45:281474976710653 -3:46:562949953421309 -3:47:1125899906842621 -3:48:2251799813685245 -3:49:4503599627370493 -3:50:9007199254740989 -3:51:18014398509481981 -3:52:36028797018963965 -3:53:72057594037927933 -3:54:144115188075855869 -3:55:288230376151711741 -3:56:576460752303423485 -3:57:1152921504606846973 -3:58:2305843009213693949 -3:59:4611686018427387901 -3:60:9223372036854775805 -3:61:18446744073709551613 -3:62:36893488147419103229 -3:63:73786976294838206461 -3:64:147573952589676412925 -3:65:295147905179352825853 -3:66:590295810358705651709 -3:67:1180591620717411303421 -3:68:2361183241434822606845 -3:69:4722366482869645213693 -3:70:9444732965739290427389 -3:71:18889465931478580854781 -3:72:37778931862957161709565 -3:73:75557863725914323419133 -3:74:151115727451828646838269 -3:75:302231454903657293676541 -3:76:604462909807314587353085 -3:77:1208925819614629174706173 -3:78:2417851639229258349412349 -3:79:4835703278458516698824701 -3:80:9671406556917033397649405 -3:81:19342813113834066795298813 -3:82:38685626227668133590597629 -3:83:77371252455336267181195261 -3:84:154742504910672534362390525 -3:85:309485009821345068724781053 -3:86:618970019642690137449562109 -3:87:1237940039285380274899124221 -3:88:2475880078570760549798248445 -3:89:4951760157141521099596496893 -3:90:9903520314283042199192993789 -3:91:19807040628566084398385987581 -3:92:39614081257132168796771975165 -3:93:79228162514264337593543950333 -3:94:158456325028528675187087900669 -3:95:316912650057057350374175801341 -3:96:633825300114114700748351602685 -3:97:1267650600228229401496703205373 -3:98:2535301200456458802993406410749 -3:99:5070602400912917605986812821501 -3:100:10141204801825835211973625643005 - -4:0:13 -4:1:65533 - -5:0:65533 diff --git a/cpan/Math-BigInt/t/bare_mbi.t b/cpan/Math-BigInt/t/bare_mbi.t index f3509cfa45..76c9069968 100644 --- a/cpan/Math-BigInt/t/bare_mbi.t +++ b/cpan/Math-BigInt/t/bare_mbi.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4280; # tests in require'd file +use Test::More tests => 4278; # tests in require'd file use lib 't'; diff --git a/cpan/Math-BigInt/t/bdigitsum-mbi.t b/cpan/Math-BigInt/t/bdigitsum-mbi.t deleted file mode 100644 index 0991191317..0000000000 --- a/cpan/Math-BigInt/t/bdigitsum-mbi.t +++ /dev/null @@ -1,113 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 48; - -use Math::BigInt; - -my $x; -my $y; - -############################################################################### -# bdigitsum() - -# Finite numbers. - -$x = Math::BigInt -> new("123"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "6"); -is($y, "6"); - -$x = Math::BigInt -> new("0"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "0"); -is($y, "0"); - -$x = Math::BigInt -> new("-123"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "6"); -is($y, "6"); - -# Infinity - -$x = Math::BigInt -> binf("+"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "NaN"); -is($y, "NaN"); - -$x = Math::BigInt -> binf("-"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "NaN"); -is($y, "NaN"); - -# NaN - -$x = Math::BigInt -> bnan(); -isa_ok($x, 'Math::BigInt'); -$y = $x -> bdigitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "NaN"); -is($y, "NaN"); - -############################################################################### -# digitsum() - -# Finite numbers. - -$x = Math::BigInt -> new("123"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "123"); -is($y, "6"); - -$x = Math::BigInt -> new("0"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "0"); -is($y, "0"); - -$x = Math::BigInt -> new("-123"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "-123"); -is($y, "6"); - -# Infinity - -$x = Math::BigInt -> binf("+"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "inf"); -is($y, "NaN"); - -$x = Math::BigInt -> binf("-"); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "-inf"); -is($y, "NaN"); - -# NaN - -$x = Math::BigInt -> bnan(); -isa_ok($x, 'Math::BigInt'); -$y = $x -> digitsum(); -isa_ok($y, 'Math::BigInt'); -is($x, "NaN"); -is($y, "NaN"); diff --git a/cpan/Math-BigInt/t/bdstr-mbf.t b/cpan/Math-BigInt/t/bdstr-mbf.t deleted file mode 100644 index 950ae6f279..0000000000 --- a/cpan/Math-BigInt/t/bdstr-mbf.t +++ /dev/null @@ -1,275 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 460; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - my $test = qq|\$x = Math::BigFloat -> new("$x_str");| - . qq| \$str = \$x -> bdstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0 - -# positive numbers - -0.000000000001:0.000000000001 -0.00000000001:0.00000000001 -0.0000000001:0.0000000001 -0.000000001:0.000000001 -0.00000001:0.00000001 -0.0000001:0.0000001 -0.000001:0.000001 -0.00001:0.00001 -0.0001:0.0001 -0.001:0.001 -0.01:0.01 -0.1:0.1 -1:1 -10:10 -100:100 -1000:1000 -10000:10000 -100000:100000 -1000000:1000000 -10000000:10000000 -100000000:100000000 -1000000000:1000000000 -10000000000:10000000000 -100000000000:100000000000 -1000000000000:1000000000000 - -0.0000000000012:0.0000000000012 -0.000000000012:0.000000000012 -0.00000000012:0.00000000012 -0.0000000012:0.0000000012 -0.000000012:0.000000012 -0.00000012:0.00000012 -0.0000012:0.0000012 -0.000012:0.000012 -0.00012:0.00012 -0.0012:0.0012 -0.012:0.012 -0.12:0.12 -1.2:1.2 -12:12 -120:120 -1200:1200 -12000:12000 -120000:120000 -1200000:1200000 -12000000:12000000 -120000000:120000000 -1200000000:1200000000 -12000000000:12000000000 -120000000000:120000000000 -1200000000000:1200000000000 - -0.00000000000123:0.00000000000123 -0.0000000000123:0.0000000000123 -0.000000000123:0.000000000123 -0.00000000123:0.00000000123 -0.0000000123:0.0000000123 -0.000000123:0.000000123 -0.00000123:0.00000123 -0.0000123:0.0000123 -0.000123:0.000123 -0.00123:0.00123 -0.0123:0.0123 -0.123:0.123 -1.23:1.23 -12.3:12.3 -123:123 -1230:1230 -12300:12300 -123000:123000 -1230000:1230000 -12300000:12300000 -123000000:123000000 -1230000000:1230000000 -12300000000:12300000000 -123000000000:123000000000 -1230000000000:1230000000000 - -0.000000000001234:0.000000000001234 -0.00000000001234:0.00000000001234 -0.0000000001234:0.0000000001234 -0.000000001234:0.000000001234 -0.00000001234:0.00000001234 -0.0000001234:0.0000001234 -0.000001234:0.000001234 -0.00001234:0.00001234 -0.0001234:0.0001234 -0.001234:0.001234 -0.01234:0.01234 -0.1234:0.1234 -1.234:1.234 -12.34:12.34 -123.4:123.4 -1234:1234 -12340:12340 -123400:123400 -1234000:1234000 -12340000:12340000 -123400000:123400000 -1234000000:1234000000 -12340000000:12340000000 -123400000000:123400000000 -1234000000000:1234000000000 - -0.000003141592:0.000003141592 -0.00003141592:0.00003141592 -0.0003141592:0.0003141592 -0.003141592:0.003141592 -0.03141592:0.03141592 -0.3141592:0.3141592 -3.141592:3.141592 -31.41592:31.41592 -314.1592:314.1592 -3141.592:3141.592 -31415.92:31415.92 -314159.2:314159.2 -3141592:3141592 - -# negative numbers - --0.000000000001:-0.000000000001 --0.00000000001:-0.00000000001 --0.0000000001:-0.0000000001 --0.000000001:-0.000000001 --0.00000001:-0.00000001 --0.0000001:-0.0000001 --0.000001:-0.000001 --0.00001:-0.00001 --0.0001:-0.0001 --0.001:-0.001 --0.01:-0.01 --0.1:-0.1 --1:-1 --10:-10 --100:-100 --1000:-1000 --10000:-10000 --100000:-100000 --1000000:-1000000 --10000000:-10000000 --100000000:-100000000 --1000000000:-1000000000 --10000000000:-10000000000 --100000000000:-100000000000 --1000000000000:-1000000000000 - --0.0000000000012:-0.0000000000012 --0.000000000012:-0.000000000012 --0.00000000012:-0.00000000012 --0.0000000012:-0.0000000012 --0.000000012:-0.000000012 --0.00000012:-0.00000012 --0.0000012:-0.0000012 --0.000012:-0.000012 --0.00012:-0.00012 --0.0012:-0.0012 --0.012:-0.012 --0.12:-0.12 --1.2:-1.2 --12:-12 --120:-120 --1200:-1200 --12000:-12000 --120000:-120000 --1200000:-1200000 --12000000:-12000000 --120000000:-120000000 --1200000000:-1200000000 --12000000000:-12000000000 --120000000000:-120000000000 --1200000000000:-1200000000000 - --0.00000000000123:-0.00000000000123 --0.0000000000123:-0.0000000000123 --0.000000000123:-0.000000000123 --0.00000000123:-0.00000000123 --0.0000000123:-0.0000000123 --0.000000123:-0.000000123 --0.00000123:-0.00000123 --0.0000123:-0.0000123 --0.000123:-0.000123 --0.00123:-0.00123 --0.0123:-0.0123 --0.123:-0.123 --1.23:-1.23 --12.3:-12.3 --123:-123 --1230:-1230 --12300:-12300 --123000:-123000 --1230000:-1230000 --12300000:-12300000 --123000000:-123000000 --1230000000:-1230000000 --12300000000:-12300000000 --123000000000:-123000000000 --1230000000000:-1230000000000 - --0.000000000001234:-0.000000000001234 --0.00000000001234:-0.00000000001234 --0.0000000001234:-0.0000000001234 --0.000000001234:-0.000000001234 --0.00000001234:-0.00000001234 --0.0000001234:-0.0000001234 --0.000001234:-0.000001234 --0.00001234:-0.00001234 --0.0001234:-0.0001234 --0.001234:-0.001234 --0.01234:-0.01234 --0.1234:-0.1234 --1.234:-1.234 --12.34:-12.34 --123.4:-123.4 --1234:-1234 --12340:-12340 --123400:-123400 --1234000:-1234000 --12340000:-12340000 --123400000:-123400000 --1234000000:-1234000000 --12340000000:-12340000000 --123400000000:-123400000000 --1234000000000:-1234000000000 - --0.000003141592:-0.000003141592 --0.00003141592:-0.00003141592 --0.0003141592:-0.0003141592 --0.003141592:-0.003141592 --0.03141592:-0.03141592 --0.3141592:-0.3141592 --3.141592:-3.141592 --31.41592:-31.41592 --314.1592:-314.1592 --3141.592:-3141.592 --31415.92:-31415.92 --314159.2:-314159.2 --3141592:-3141592 diff --git a/cpan/Math-BigInt/t/bdstr-mbi.t b/cpan/Math-BigInt/t/bdstr-mbi.t deleted file mode 100644 index 68671619cf..0000000000 --- a/cpan/Math-BigInt/t/bdstr-mbi.t +++ /dev/null @@ -1,155 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 220; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - my $test = qq|\$x = Math::BigInt -> new("$x_str");| - . qq| \$str = \$x -> bdstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0 - -# positive numbers - -1:1 -10:10 -100:100 -1000:1000 -10000:10000 -100000:100000 -1000000:1000000 -10000000:10000000 -100000000:100000000 -1000000000:1000000000 -10000000000:10000000000 -100000000000:100000000000 -1000000000000:1000000000000 - -12:12 -120:120 -1200:1200 -12000:12000 -120000:120000 -1200000:1200000 -12000000:12000000 -120000000:120000000 -1200000000:1200000000 -12000000000:12000000000 -120000000000:120000000000 -1200000000000:1200000000000 - -123:123 -1230:1230 -12300:12300 -123000:123000 -1230000:1230000 -12300000:12300000 -123000000:123000000 -1230000000:1230000000 -12300000000:12300000000 -123000000000:123000000000 -1230000000000:1230000000000 - -1234:1234 -12340:12340 -123400:123400 -1234000:1234000 -12340000:12340000 -123400000:123400000 -1234000000:1234000000 -12340000000:12340000000 -123400000000:123400000000 -1234000000000:1234000000000 - -3:3 -31:31 -314:314 -3141:3141 -31415:31415 -314159:314159 -3141592:3141592 - -# negative numbers - --1:-1 --10:-10 --100:-100 --1000:-1000 --10000:-10000 --100000:-100000 --1000000:-1000000 --10000000:-10000000 --100000000:-100000000 --1000000000:-1000000000 --10000000000:-10000000000 --100000000000:-100000000000 --1000000000000:-1000000000000 - --12:-12 --120:-120 --1200:-1200 --12000:-12000 --120000:-120000 --1200000:-1200000 --12000000:-12000000 --120000000:-120000000 --1200000000:-1200000000 --12000000000:-12000000000 --120000000000:-120000000000 --1200000000000:-1200000000000 - --123:-123 --1230:-1230 --12300:-12300 --123000:-123000 --1230000:-1230000 --12300000:-12300000 --123000000:-123000000 --1230000000:-1230000000 --12300000000:-12300000000 --123000000000:-123000000000 --1230000000000:-1230000000000 - --1234:-1234 --12340:-12340 --123400:-123400 --1234000:-1234000 --12340000:-12340000 --123400000:-123400000 --1234000000:-1234000000 --12340000000:-12340000000 --123400000000:-123400000000 --1234000000000:-1234000000000 - --3:-3 --31:-31 --314:-314 --3141:-3141 --31415:-31415 --314159:-314159 --3141592:-3141592 diff --git a/cpan/Math-BigInt/t/bestr-mbf.t b/cpan/Math-BigInt/t/bestr-mbf.t deleted file mode 100644 index 12277a5272..0000000000 --- a/cpan/Math-BigInt/t/bestr-mbf.t +++ /dev/null @@ -1,275 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 460; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - my $test = qq|\$x = Math::BigFloat -> new("$x_str");| - . qq| \$str = \$x -> bestr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -0.000000000001:1e-12 -0.00000000001:10e-12 -0.0000000001:100e-12 -0.000000001:1e-9 -0.00000001:10e-9 -0.0000001:100e-9 -0.000001:1e-6 -0.00001:10e-6 -0.0001:100e-6 -0.001:1e-3 -0.01:10e-3 -0.1:100e-3 -1:1e+0 -10:10e+0 -100:100e+0 -1000:1e+3 -10000:10e+3 -100000:100e+3 -1000000:1e+6 -10000000:10e+6 -100000000:100e+6 -1000000000:1e+9 -10000000000:10e+9 -100000000000:100e+9 -1000000000000:1e+12 - -0.0000000000012:1.2e-12 -0.000000000012:12e-12 -0.00000000012:120e-12 -0.0000000012:1.2e-9 -0.000000012:12e-9 -0.00000012:120e-9 -0.0000012:1.2e-6 -0.000012:12e-6 -0.00012:120e-6 -0.0012:1.2e-3 -0.012:12e-3 -0.12:120e-3 -1.2:1.2e+0 -12:12e+0 -120:120e+0 -1200:1.2e+3 -12000:12e+3 -120000:120e+3 -1200000:1.2e+6 -12000000:12e+6 -120000000:120e+6 -1200000000:1.2e+9 -12000000000:12e+9 -120000000000:120e+9 -1200000000000:1.2e+12 - -0.00000000000123:1.23e-12 -0.0000000000123:12.3e-12 -0.000000000123:123e-12 -0.00000000123:1.23e-9 -0.0000000123:12.3e-9 -0.000000123:123e-9 -0.00000123:1.23e-6 -0.0000123:12.3e-6 -0.000123:123e-6 -0.00123:1.23e-3 -0.0123:12.3e-3 -0.123:123e-3 -1.23:1.23e+0 -12.3:12.3e+0 -123:123e+0 -1230:1.23e+3 -12300:12.3e+3 -123000:123e+3 -1230000:1.23e+6 -12300000:12.3e+6 -123000000:123e+6 -1230000000:1.23e+9 -12300000000:12.3e+9 -123000000000:123e+9 -1230000000000:1.23e+12 - -0.000000000001234:1.234e-12 -0.00000000001234:12.34e-12 -0.0000000001234:123.4e-12 -0.000000001234:1.234e-9 -0.00000001234:12.34e-9 -0.0000001234:123.4e-9 -0.000001234:1.234e-6 -0.00001234:12.34e-6 -0.0001234:123.4e-6 -0.001234:1.234e-3 -0.01234:12.34e-3 -0.1234:123.4e-3 -1.234:1.234e+0 -12.34:12.34e+0 -123.4:123.4e+0 -1234:1.234e+3 -12340:12.34e+3 -123400:123.4e+3 -1234000:1.234e+6 -12340000:12.34e+6 -123400000:123.4e+6 -1234000000:1.234e+9 -12340000000:12.34e+9 -123400000000:123.4e+9 -1234000000000:1.234e+12 - -0.000003141592:3.141592e-6 -0.00003141592:31.41592e-6 -0.0003141592:314.1592e-6 -0.003141592:3.141592e-3 -0.03141592:31.41592e-3 -0.3141592:314.1592e-3 -3.141592:3.141592e+0 -31.41592:31.41592e+0 -314.1592:314.1592e+0 -3141.592:3.141592e+3 -31415.92:31.41592e+3 -314159.2:314.1592e+3 -3141592:3.141592e+6 - -# negative numbers - --0.000000000001:-1e-12 --0.00000000001:-10e-12 --0.0000000001:-100e-12 --0.000000001:-1e-9 --0.00000001:-10e-9 --0.0000001:-100e-9 --0.000001:-1e-6 --0.00001:-10e-6 --0.0001:-100e-6 --0.001:-1e-3 --0.01:-10e-3 --0.1:-100e-3 --1:-1e+0 --10:-10e+0 --100:-100e+0 --1000:-1e+3 --10000:-10e+3 --100000:-100e+3 --1000000:-1e+6 --10000000:-10e+6 --100000000:-100e+6 --1000000000:-1e+9 --10000000000:-10e+9 --100000000000:-100e+9 --1000000000000:-1e+12 - --0.0000000000012:-1.2e-12 --0.000000000012:-12e-12 --0.00000000012:-120e-12 --0.0000000012:-1.2e-9 --0.000000012:-12e-9 --0.00000012:-120e-9 --0.0000012:-1.2e-6 --0.000012:-12e-6 --0.00012:-120e-6 --0.0012:-1.2e-3 --0.012:-12e-3 --0.12:-120e-3 --1.2:-1.2e+0 --12:-12e+0 --120:-120e+0 --1200:-1.2e+3 --12000:-12e+3 --120000:-120e+3 --1200000:-1.2e+6 --12000000:-12e+6 --120000000:-120e+6 --1200000000:-1.2e+9 --12000000000:-12e+9 --120000000000:-120e+9 --1200000000000:-1.2e+12 - --0.00000000000123:-1.23e-12 --0.0000000000123:-12.3e-12 --0.000000000123:-123e-12 --0.00000000123:-1.23e-9 --0.0000000123:-12.3e-9 --0.000000123:-123e-9 --0.00000123:-1.23e-6 --0.0000123:-12.3e-6 --0.000123:-123e-6 --0.00123:-1.23e-3 --0.0123:-12.3e-3 --0.123:-123e-3 --1.23:-1.23e+0 --12.3:-12.3e+0 --123:-123e+0 --1230:-1.23e+3 --12300:-12.3e+3 --123000:-123e+3 --1230000:-1.23e+6 --12300000:-12.3e+6 --123000000:-123e+6 --1230000000:-1.23e+9 --12300000000:-12.3e+9 --123000000000:-123e+9 --1230000000000:-1.23e+12 - --0.000000000001234:-1.234e-12 --0.00000000001234:-12.34e-12 --0.0000000001234:-123.4e-12 --0.000000001234:-1.234e-9 --0.00000001234:-12.34e-9 --0.0000001234:-123.4e-9 --0.000001234:-1.234e-6 --0.00001234:-12.34e-6 --0.0001234:-123.4e-6 --0.001234:-1.234e-3 --0.01234:-12.34e-3 --0.1234:-123.4e-3 --1.234:-1.234e+0 --12.34:-12.34e+0 --123.4:-123.4e+0 --1234:-1.234e+3 --12340:-12.34e+3 --123400:-123.4e+3 --1234000:-1.234e+6 --12340000:-12.34e+6 --123400000:-123.4e+6 --1234000000:-1.234e+9 --12340000000:-12.34e+9 --123400000000:-123.4e+9 --1234000000000:-1.234e+12 - --0.000003141592:-3.141592e-6 --0.00003141592:-31.41592e-6 --0.0003141592:-314.1592e-6 --0.003141592:-3.141592e-3 --0.03141592:-31.41592e-3 --0.3141592:-314.1592e-3 --3.141592:-3.141592e+0 --31.41592:-31.41592e+0 --314.1592:-314.1592e+0 --3141.592:-3.141592e+3 --31415.92:-31.41592e+3 --314159.2:-314.1592e+3 --3141592:-3.141592e+6 diff --git a/cpan/Math-BigInt/t/bestr-mbi.t b/cpan/Math-BigInt/t/bestr-mbi.t deleted file mode 100644 index 8c4c0bd518..0000000000 --- a/cpan/Math-BigInt/t/bestr-mbi.t +++ /dev/null @@ -1,155 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 220; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - my $test = qq|\$x = Math::BigInt -> new("$x_str");| - . qq| \$str = \$x -> bestr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -1:1e+0 -10:10e+0 -100:100e+0 -1000:1e+3 -10000:10e+3 -100000:100e+3 -1000000:1e+6 -10000000:10e+6 -100000000:100e+6 -1000000000:1e+9 -10000000000:10e+9 -100000000000:100e+9 -1000000000000:1e+12 - -12:12e+0 -120:120e+0 -1200:1.2e+3 -12000:12e+3 -120000:120e+3 -1200000:1.2e+6 -12000000:12e+6 -120000000:120e+6 -1200000000:1.2e+9 -12000000000:12e+9 -120000000000:120e+9 -1200000000000:1.2e+12 - -123:123e+0 -1230:1.23e+3 -12300:12.3e+3 -123000:123e+3 -1230000:1.23e+6 -12300000:12.3e+6 -123000000:123e+6 -1230000000:1.23e+9 -12300000000:12.3e+9 -123000000000:123e+9 -1230000000000:1.23e+12 - -1234:1.234e+3 -12340:12.34e+3 -123400:123.4e+3 -1234000:1.234e+6 -12340000:12.34e+6 -123400000:123.4e+6 -1234000000:1.234e+9 -12340000000:12.34e+9 -123400000000:123.4e+9 -1234000000000:1.234e+12 - -3:3e+0 -31:31e+0 -314:314e+0 -3141:3.141e+3 -31415:31.415e+3 -314159:314.159e+3 -3141592:3.141592e+6 - -# negative numbers - --1:-1e+0 --10:-10e+0 --100:-100e+0 --1000:-1e+3 --10000:-10e+3 --100000:-100e+3 --1000000:-1e+6 --10000000:-10e+6 --100000000:-100e+6 --1000000000:-1e+9 --10000000000:-10e+9 --100000000000:-100e+9 --1000000000000:-1e+12 - --12:-12e+0 --120:-120e+0 --1200:-1.2e+3 --12000:-12e+3 --120000:-120e+3 --1200000:-1.2e+6 --12000000:-12e+6 --120000000:-120e+6 --1200000000:-1.2e+9 --12000000000:-12e+9 --120000000000:-120e+9 --1200000000000:-1.2e+12 - --123:-123e+0 --1230:-1.23e+3 --12300:-12.3e+3 --123000:-123e+3 --1230000:-1.23e+6 --12300000:-12.3e+6 --123000000:-123e+6 --1230000000:-1.23e+9 --12300000000:-12.3e+9 --123000000000:-123e+9 --1230000000000:-1.23e+12 - --1234:-1.234e+3 --12340:-12.34e+3 --123400:-123.4e+3 --1234000:-1.234e+6 --12340000:-12.34e+6 --123400000:-123.4e+6 --1234000000:-1.234e+9 --12340000000:-12.34e+9 --123400000000:-123.4e+9 --1234000000000:-1.234e+12 - --3:-3e+0 --31:-31e+0 --314:-314e+0 --3141:-3.141e+3 --31415:-31.415e+3 --314159:-314.159e+3 --3141592:-3.141592e+6 diff --git a/cpan/Math-BigInt/t/bfib-mbi.t b/cpan/Math-BigInt/t/bfib-mbi.t deleted file mode 100644 index 91e7aafad5..0000000000 --- a/cpan/Math-BigInt/t/bfib-mbi.t +++ /dev/null @@ -1,86 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 15; - -use Math::BigInt; - -my $x; - -############################################################################### -# Scalar context. -############################################################################### - -my $y; - -# Finite numbers. - -$x = Math::BigInt -> new("-20"); -$y = $x -> bfib(); -is($y, "-6765", "bfib(-20)"); - -$x = Math::BigInt -> new("-15"); -$y = $x -> bfib(); -is($y, "610", "bfib(-15)"); - -$x = Math::BigInt -> new("-2"); -$y = $x -> bfib(); -is($y, "-1", "bfib(-2)"); - -$x = Math::BigInt -> new("-1"); -$y = $x -> bfib(); -is($y, "1", "bfib(-1)"); - -$x = Math::BigInt -> new("0"); -$y = $x -> bfib(); -is($y, "0", "bfib(0)"); - -$x = Math::BigInt -> new("1"); -$y = $x -> bfib(); -is($y, "1", "bfib(1)"); - -$x = Math::BigInt -> new("2"); -$y = $x -> bfib(); -is($y, "1", "bfib(2)"); - -$x = Math::BigInt -> new("15"); -$y = $x -> bfib(); -is($y, "610", "bfib(15)"); - -$x = Math::BigInt -> new("20"); -$y = $x -> bfib(); -is($y, "6765", "bfib(20)"); - -$x = Math::BigInt -> new("250"); -$y = $x -> bfib(); -is($y, "7896325826131730509282738943634332893686268675876375", "bfib(250)"); - -# Infinites and NaN. - -$x = Math::BigInt -> binf("+"); -$y = $x -> bfib(); -is($y, "inf", "bfib(+inf)"); - -$x = Math::BigInt -> binf("-"); -$y = $x -> bfib(); -is($y, "NaN", "bfib(-inf)"); - -$x = Math::BigInt -> bnan(); -$y = $x -> bfib(); -is($y, "NaN", "bfib(NaN)"); - -############################################################################### -# List context. -############################################################################### - -my @y; - -$x = Math::BigInt -> new("10"); -@y = $x -> bfib(); -is_deeply(\@y, [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55], "bfib(10)"); - -$x = Math::BigInt -> new("-10"); -@y = $x -> bfib(); -is_deeply(\@y, [0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55], "bfib(-10)"); diff --git a/cpan/Math-BigInt/t/bigfltpm.inc b/cpan/Math-BigInt/t/bigfltpm.inc index 0b25505849..bd7e285e23 100644 --- a/cpan/Math-BigInt/t/bigfltpm.inc +++ b/cpan/Math-BigInt/t/bigfltpm.inc @@ -44,7 +44,8 @@ while (<DATA>) { } elsif ($f eq "binf") { $try .= qq| \$x->binf("$args[1]");|; } elsif ($f eq "bone") { - $try .= qq| \$x->bone("$args[1]");|; + $try .= length($args[1]) ? qq| \$x->bone("$args[1]");| + : qq| \$x->bone();|; } elsif ($f eq "bstr") { $try .= qq| \$x->accuracy($args[1]); \$x->precision($args[2]);|; $try .= ' $x->bstr();'; @@ -524,8 +525,8 @@ NaN:10:NaN -inf:10:NaN 1.2:10:0.3623577545 2.4:12:-0.737393715541 -0:10:1 -0:20:1 +0:10:1.000000000 +0:20:1.0000000000000000000 1:10:0.5403023059 1:12:0.540302305868 @@ -867,7 +868,7 @@ abc:NaN 0::1 -2::1 abc::1 -2:abc:1 +2::1 &bsstr +inf:inf diff --git a/cpan/Math-BigInt/t/bigintpm.inc b/cpan/Math-BigInt/t/bigintpm.inc index 3090699b5f..ae029a2a16 100644 --- a/cpan/Math-BigInt/t/bigintpm.inc +++ b/cpan/Math-BigInt/t/bigintpm.inc @@ -1415,13 +1415,12 @@ abc:NaN 2:-:-1 invalid:-:-1 invalid:+:1 -2:abc:1 3::1 &binf 1:+:inf 2:-:-inf -3:abc:inf +3:+inf:inf &is_nan 123:0 diff --git a/cpan/Math-BigInt/t/bigintpm.t b/cpan/Math-BigInt/t/bigintpm.t index 3b78f2e1af..bc234e6b06 100644 --- a/cpan/Math-BigInt/t/bigintpm.t +++ b/cpan/Math-BigInt/t/bigintpm.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4280 # tests in require'd file +use Test::More tests => 4278 # tests in require'd file + 20; # tests in this file use Math::BigInt only => 'Calc'; diff --git a/cpan/Math-BigInt/t/biglog.t b/cpan/Math-BigInt/t/biglog.t index 6045a6f8c3..79d8fdfa93 100644 --- a/cpan/Math-BigInt/t/biglog.t +++ b/cpan/Math-BigInt/t/biglog.t @@ -36,7 +36,6 @@ is($class->new(2)->bexp(), '7', "$class->new(2)->bexp()"); is($class->new(3)->bexp(), '20', "$class->new(3)->bexp()"); ############################################################################### -############################################################################### # Math::BigFloat tests ############################################################################### @@ -146,7 +145,7 @@ is($class->new("10")->bpow("0.6", 10), "3.981071706", qq|$class->new("10")->bpow("0.6", 10)|); # blog should handle bigint input -is(Math::BigFloat::blog(Math::BigInt->new(100), 10), 2, "blog(100)"); +is(Math::BigFloat->blog(Math::BigInt->new(100), 10), 2, "blog(100)"); ############################################################################### # some integer results @@ -190,9 +189,9 @@ test_bpow('9.86902225', '0.5', undef, '3.1415'); test_bpow('0.2', '0.41', 10, '0.5169187652'); -is($class->new("0.01")->bpow("28.4", 40)->bsstr(), - '1584893192461113485202101373391507013269e-96', - qq|$class->new("0.01")->bpow("28.4", 40)->bsstr()|); +is($class->new("0.1")->bpow("28.4", 40)->bsstr(), + '3981071705534972507702523050877520434877e-68', + qq|$class->new("0.1")->bpow("28.4", 40)->bsstr()|); # The following test takes too long. #is($class->new("2")->bpow("-1034.5", 40)->bsstr(), @@ -231,8 +230,6 @@ is($class->new("-394.84010945715266885")->bexp(20)->bsstr(), # all done -1; - ############################################################################### sub test_bpow { diff --git a/cpan/Math-BigInt/t/blucas-mbi.t b/cpan/Math-BigInt/t/blucas-mbi.t deleted file mode 100644 index 9a9215929f..0000000000 --- a/cpan/Math-BigInt/t/blucas-mbi.t +++ /dev/null @@ -1,86 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 15; - -use Math::BigInt; - -my $x; - -############################################################################### -# Scalar context. -############################################################################### - -my $y; - -# Finite numbers. - -$x = Math::BigInt -> new("-20"); -$y = $x -> blucas(); -is($y, "-15127", "blucas(-20)"); - -$x = Math::BigInt -> new("-15"); -$y = $x -> blucas(); -is($y, "1364", "blucas(-15)"); - -$x = Math::BigInt -> new("-2"); -$y = $x -> blucas(); -is($y, "-3", "blucas(-2)"); - -$x = Math::BigInt -> new("-1"); -$y = $x -> blucas(); -is($y, "1", "blucas(-1)"); - -$x = Math::BigInt -> new("0"); -$y = $x -> blucas(); -is($y, "2", "blucas(0)"); - -$x = Math::BigInt -> new("1"); -$y = $x -> blucas(); -is($y, "1", "blucas(1)"); - -$x = Math::BigInt -> new("2"); -$y = $x -> blucas(); -is($y, "3", "blucas(2)"); - -$x = Math::BigInt -> new("15"); -$y = $x -> blucas(); -is($y, "1364", "blucas(15)"); - -$x = Math::BigInt -> new("20"); -$y = $x -> blucas(); -is($y, "15127", "blucas(20)"); - -$x = Math::BigInt -> new("250"); -$y = $x -> blucas(); -is($y, "17656721319717734662791328845675730903632844218828123", "blucas(250)"); - -# Infinites and NaN. - -$x = Math::BigInt -> binf("+"); -$y = $x -> blucas(); -is($y, "inf", "blucas(+inf)"); - -$x = Math::BigInt -> binf("-"); -$y = $x -> blucas(); -is($y, "NaN", "blucas(-inf)"); - -$x = Math::BigInt -> bnan(); -$y = $x -> blucas(); -is($y, "NaN", "blucas(NaN)"); - -############################################################################### -# List context. -############################################################################### - -my @y; - -$x = Math::BigInt -> new("10"); -@y = $x -> blucas(); -is_deeply(\@y, [2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123], "blucas(10)"); - -$x = Math::BigInt -> new("-10"); -@y = $x -> blucas(); -is_deeply(\@y, [2, 1, -3, 4, -7, 11, -18, 29, -47, 76, -123], "blucas(-10)"); diff --git a/cpan/Math-BigInt/t/bnok-mbf.t b/cpan/Math-BigInt/t/bnok-mbf.t deleted file mode 100644 index d8b915121b..0000000000 --- a/cpan/Math-BigInt/t/bnok-mbf.t +++ /dev/null @@ -1,1451 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 4957; - -my $class; - -BEGIN { - $class = 'Math::BigFloat'; - use_ok($class); -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($nval, $kval, $nokval) = split /:/; - my ($n, $k, $got, @got); - - for my $context_is_scalar (0, 1) { - for my $k_is_scalar (0, 1) { - - my $test = qq|\$n = $class -> new("$nval");|; - - $test .= $k_is_scalar - ? qq| \$k = "$kval";| - : qq| \$k = $class -> new("$kval");|; - - $test .= $context_is_scalar - ? qq| \$got = \$n -> bnok(\$k);| - : qq| \@got = \$n -> bnok(\$k);|; - - my $desc = "bnok() in "; - $desc .= $context_is_scalar ? "scalar context" : "list context"; - $desc .= $k_is_scalar ? " with k as scalar" : " with k as object"; - - subtest $desc, - sub { - plan tests => $context_is_scalar ? 7 : 8; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - if ($context_is_scalar) { - - # Check output. - - is(ref($got), $class, - "'$test' output arg is a $class"); - - is($got -> bstr(), $nokval, - "'$test' output arg has the right value"); - - } else { - - # Check number of output arguments. - - cmp_ok(scalar @got, '==', 1, - "'$test' gives one output arg"); - - # Check output. - - is(ref($got[0]), $class, - "'$test' output arg is a $class"); - - is($got[0] -> bstr(), $nokval, - "'$test' output arg has the right value"); - } - - # Check the invocand. - - is(ref($n), $class, - "'$test' invocand is still a $class"); - - is($n -> bstr(), $nokval, - "'$test' invocand has the right value"); - - # Check the input argument. - - if ($k_is_scalar) { - - is(ref($k), '', - "'$test' second input arg is still a scalar"); - - is($k, $kval, - "'$test' second input arg is unmodified"); - - } else { - - is(ref($k), $class, - "'$test' second input arg is still a $class"); - - is($k -> bstr(), $kval, - "'$test' second input arg is unmodified"); - } - }; - } - } -} - -__DATA__ - -# n and/or k is NaN - -NaN:NaN:NaN -NaN:0:NaN -NaN:3:NaN -3:NaN:NaN -NaN:-3:NaN --3:NaN:NaN - -# n = inf - -inf:-inf:NaN -inf:-3:0 -inf:-2:0 -inf:-1:0 -inf:0:1 -inf:1:inf -inf:2:inf -inf:3:inf -inf:inf:NaN - -# n = -inf - --inf:-inf:NaN --inf:-3:0 --inf:-2:0 --inf:-1:0 --inf:0:1 --inf:1:-inf --inf:2:inf --inf:3:-inf --inf:inf:NaN - -# k = inf - --3:inf:NaN --2:inf:NaN --1:inf:NaN -0:inf:NaN -1:inf:NaN -2:inf:NaN -3:inf:NaN - -# k = -inf - --3:-inf:NaN --2:-inf:NaN --1:-inf:NaN -0:-inf:NaN -1:-inf:NaN -2:-inf:NaN -3:-inf:NaN - -# n = -15, k = n - 15 ... n + 15 - --15:-30:-77558760 --15:-29:40116600 --15:-28:-20058300 --15:-27:9657700 --15:-26:-4457400 --15:-25:1961256 --15:-24:-817190 --15:-23:319770 --15:-22:-116280 --15:-21:38760 --15:-20:-11628 --15:-19:3060 --15:-18:-680 --15:-17:120 --15:-16:-15 --15:-15:1 --15:-14:0 --15:-13:0 --15:-12:0 --15:-11:0 --15:-10:0 --15:-9:0 --15:-8:0 --15:-7:0 --15:-6:0 --15:-5:0 --15:-4:0 --15:-3:0 --15:-2:0 --15:-1:0 --15:0:1 --15:1:-15 --15:2:120 --15:3:-680 --15:4:3060 --15:5:-11628 --15:6:38760 --15:7:-116280 --15:8:319770 --15:9:-817190 --15:10:1961256 --15:11:-4457400 --15:12:9657700 --15:13:-20058300 --15:14:40116600 --15:15:-77558760 - -# n = -14, k = n - 15 ... n + 15 - --14:-29:-37442160 --14:-28:20058300 --14:-27:-10400600 --14:-26:5200300 --14:-25:-2496144 --14:-24:1144066 --14:-23:-497420 --14:-22:203490 --14:-21:-77520 --14:-20:27132 --14:-19:-8568 --14:-18:2380 --14:-17:-560 --14:-16:105 --14:-15:-14 --14:-14:1 --14:-13:0 --14:-12:0 --14:-11:0 --14:-10:0 --14:-9:0 --14:-8:0 --14:-7:0 --14:-6:0 --14:-5:0 --14:-4:0 --14:-3:0 --14:-2:0 --14:-1:0 --14:0:1 --14:1:-14 --14:2:105 --14:3:-560 --14:4:2380 --14:5:-8568 --14:6:27132 --14:7:-77520 --14:8:203490 --14:9:-497420 --14:10:1144066 --14:11:-2496144 --14:12:5200300 --14:13:-10400600 --14:14:20058300 --14:15:-37442160 - -# n = -13, k = n - 15 ... n + 15 - --13:-28:-17383860 --13:-27:9657700 --13:-26:-5200300 --13:-25:2704156 --13:-24:-1352078 --13:-23:646646 --13:-22:-293930 --13:-21:125970 --13:-20:-50388 --13:-19:18564 --13:-18:-6188 --13:-17:1820 --13:-16:-455 --13:-15:91 --13:-14:-13 --13:-13:1 --13:-12:0 --13:-11:0 --13:-10:0 --13:-9:0 --13:-8:0 --13:-7:0 --13:-6:0 --13:-5:0 --13:-4:0 --13:-3:0 --13:-2:0 --13:-1:0 --13:0:1 --13:1:-13 --13:2:91 --13:3:-455 --13:4:1820 --13:5:-6188 --13:6:18564 --13:7:-50388 --13:8:125970 --13:9:-293930 --13:10:646646 --13:11:-1352078 --13:12:2704156 --13:13:-5200300 --13:14:9657700 --13:15:-17383860 - -# n = -12, k = n - 15 ... n + 15 - --12:-27:-7726160 --12:-26:4457400 --12:-25:-2496144 --12:-24:1352078 --12:-23:-705432 --12:-22:352716 --12:-21:-167960 --12:-20:75582 --12:-19:-31824 --12:-18:12376 --12:-17:-4368 --12:-16:1365 --12:-15:-364 --12:-14:78 --12:-13:-12 --12:-12:1 --12:-11:0 --12:-10:0 --12:-9:0 --12:-8:0 --12:-7:0 --12:-6:0 --12:-5:0 --12:-4:0 --12:-3:0 --12:-2:0 --12:-1:0 --12:0:1 --12:1:-12 --12:2:78 --12:3:-364 --12:4:1365 --12:5:-4368 --12:6:12376 --12:7:-31824 --12:8:75582 --12:9:-167960 --12:10:352716 --12:11:-705432 --12:12:1352078 --12:13:-2496144 --12:14:4457400 --12:15:-7726160 - -# n = -11, k = n - 15 ... n + 15 - --11:-26:-3268760 --11:-25:1961256 --11:-24:-1144066 --11:-23:646646 --11:-22:-352716 --11:-21:184756 --11:-20:-92378 --11:-19:43758 --11:-18:-19448 --11:-17:8008 --11:-16:-3003 --11:-15:1001 --11:-14:-286 --11:-13:66 --11:-12:-11 --11:-11:1 --11:-10:0 --11:-9:0 --11:-8:0 --11:-7:0 --11:-6:0 --11:-5:0 --11:-4:0 --11:-3:0 --11:-2:0 --11:-1:0 --11:0:1 --11:1:-11 --11:2:66 --11:3:-286 --11:4:1001 --11:5:-3003 --11:6:8008 --11:7:-19448 --11:8:43758 --11:9:-92378 --11:10:184756 --11:11:-352716 --11:12:646646 --11:13:-1144066 --11:14:1961256 --11:15:-3268760 - -# n = -10, k = n - 15 ... n + 15 - --10:-25:-1307504 --10:-24:817190 --10:-23:-497420 --10:-22:293930 --10:-21:-167960 --10:-20:92378 --10:-19:-48620 --10:-18:24310 --10:-17:-11440 --10:-16:5005 --10:-15:-2002 --10:-14:715 --10:-13:-220 --10:-12:55 --10:-11:-10 --10:-10:1 --10:-9:0 --10:-8:0 --10:-7:0 --10:-6:0 --10:-5:0 --10:-4:0 --10:-3:0 --10:-2:0 --10:-1:0 --10:0:1 --10:1:-10 --10:2:55 --10:3:-220 --10:4:715 --10:5:-2002 --10:6:5005 --10:7:-11440 --10:8:24310 --10:9:-48620 --10:10:92378 --10:11:-167960 --10:12:293930 --10:13:-497420 --10:14:817190 --10:15:-1307504 - -# n = -9, k = n - 15 ... n + 15 - --9:-24:-490314 --9:-23:319770 --9:-22:-203490 --9:-21:125970 --9:-20:-75582 --9:-19:43758 --9:-18:-24310 --9:-17:12870 --9:-16:-6435 --9:-15:3003 --9:-14:-1287 --9:-13:495 --9:-12:-165 --9:-11:45 --9:-10:-9 --9:-9:1 --9:-8:0 --9:-7:0 --9:-6:0 --9:-5:0 --9:-4:0 --9:-3:0 --9:-2:0 --9:-1:0 --9:0:1 --9:1:-9 --9:2:45 --9:3:-165 --9:4:495 --9:5:-1287 --9:6:3003 --9:7:-6435 --9:8:12870 --9:9:-24310 --9:10:43758 --9:11:-75582 --9:12:125970 --9:13:-203490 --9:14:319770 --9:15:-490314 - -# n = -8, k = n - 15 ... n + 15 - --8:-23:-170544 --8:-22:116280 --8:-21:-77520 --8:-20:50388 --8:-19:-31824 --8:-18:19448 --8:-17:-11440 --8:-16:6435 --8:-15:-3432 --8:-14:1716 --8:-13:-792 --8:-12:330 --8:-11:-120 --8:-10:36 --8:-9:-8 --8:-8:1 --8:-7:0 --8:-6:0 --8:-5:0 --8:-4:0 --8:-3:0 --8:-2:0 --8:-1:0 --8:0:1 --8:1:-8 --8:2:36 --8:3:-120 --8:4:330 --8:5:-792 --8:6:1716 --8:7:-3432 --8:8:6435 --8:9:-11440 --8:10:19448 --8:11:-31824 --8:12:50388 --8:13:-77520 --8:14:116280 --8:15:-170544 - -# n = -7, k = n - 15 ... n + 15 - --7:-22:-54264 --7:-21:38760 --7:-20:-27132 --7:-19:18564 --7:-18:-12376 --7:-17:8008 --7:-16:-5005 --7:-15:3003 --7:-14:-1716 --7:-13:924 --7:-12:-462 --7:-11:210 --7:-10:-84 --7:-9:28 --7:-8:-7 --7:-7:1 --7:-6:0 --7:-5:0 --7:-4:0 --7:-3:0 --7:-2:0 --7:-1:0 --7:0:1 --7:1:-7 --7:2:28 --7:3:-84 --7:4:210 --7:5:-462 --7:6:924 --7:7:-1716 --7:8:3003 --7:9:-5005 --7:10:8008 --7:11:-12376 --7:12:18564 --7:13:-27132 --7:14:38760 --7:15:-54264 - -# n = -6, k = n - 15 ... n + 15 - --6:-21:-15504 --6:-20:11628 --6:-19:-8568 --6:-18:6188 --6:-17:-4368 --6:-16:3003 --6:-15:-2002 --6:-14:1287 --6:-13:-792 --6:-12:462 --6:-11:-252 --6:-10:126 --6:-9:-56 --6:-8:21 --6:-7:-6 --6:-6:1 --6:-5:0 --6:-4:0 --6:-3:0 --6:-2:0 --6:-1:0 --6:0:1 --6:1:-6 --6:2:21 --6:3:-56 --6:4:126 --6:5:-252 --6:6:462 --6:7:-792 --6:8:1287 --6:9:-2002 --6:10:3003 --6:11:-4368 --6:12:6188 --6:13:-8568 --6:14:11628 --6:15:-15504 - -# n = -5, k = n - 15 ... n + 15 - --5:-20:-3876 --5:-19:3060 --5:-18:-2380 --5:-17:1820 --5:-16:-1365 --5:-15:1001 --5:-14:-715 --5:-13:495 --5:-12:-330 --5:-11:210 --5:-10:-126 --5:-9:70 --5:-8:-35 --5:-7:15 --5:-6:-5 --5:-5:1 --5:-4:0 --5:-3:0 --5:-2:0 --5:-1:0 --5:0:1 --5:1:-5 --5:2:15 --5:3:-35 --5:4:70 --5:5:-126 --5:6:210 --5:7:-330 --5:8:495 --5:9:-715 --5:10:1001 --5:11:-1365 --5:12:1820 --5:13:-2380 --5:14:3060 --5:15:-3876 - -# n = -4, k = n - 15 ... n + 15 - --4:-19:-816 --4:-18:680 --4:-17:-560 --4:-16:455 --4:-15:-364 --4:-14:286 --4:-13:-220 --4:-12:165 --4:-11:-120 --4:-10:84 --4:-9:-56 --4:-8:35 --4:-7:-20 --4:-6:10 --4:-5:-4 --4:-4:1 --4:-3:0 --4:-2:0 --4:-1:0 --4:0:1 --4:1:-4 --4:2:10 --4:3:-20 --4:4:35 --4:5:-56 --4:6:84 --4:7:-120 --4:8:165 --4:9:-220 --4:10:286 --4:11:-364 --4:12:455 --4:13:-560 --4:14:680 --4:15:-816 - -# n = -3, k = n - 15 ... n + 15 - --3:-18:-136 --3:-17:120 --3:-16:-105 --3:-15:91 --3:-14:-78 --3:-13:66 --3:-12:-55 --3:-11:45 --3:-10:-36 --3:-9:28 --3:-8:-21 --3:-7:15 --3:-6:-10 --3:-5:6 --3:-4:-3 --3:-3:1 --3:-2:0 --3:-1:0 --3:0:1 --3:1:-3 --3:2:6 --3:3:-10 --3:4:15 --3:5:-21 --3:6:28 --3:7:-36 --3:8:45 --3:9:-55 --3:10:66 --3:11:-78 --3:12:91 --3:13:-105 --3:14:120 --3:15:-136 - -# n = -2, k = n - 15 ... n + 15 - --2:-17:-16 --2:-16:15 --2:-15:-14 --2:-14:13 --2:-13:-12 --2:-12:11 --2:-11:-10 --2:-10:9 --2:-9:-8 --2:-8:7 --2:-7:-6 --2:-6:5 --2:-5:-4 --2:-4:3 --2:-3:-2 --2:-2:1 --2:-1:0 --2:0:1 --2:1:-2 --2:2:3 --2:3:-4 --2:4:5 --2:5:-6 --2:6:7 --2:7:-8 --2:8:9 --2:9:-10 --2:10:11 --2:11:-12 --2:12:13 --2:13:-14 --2:14:15 --2:15:-16 - -# n = -1, k = n - 15 ... n + 15 - --1:-16:-1 --1:-15:1 --1:-14:-1 --1:-13:1 --1:-12:-1 --1:-11:1 --1:-10:-1 --1:-9:1 --1:-8:-1 --1:-7:1 --1:-6:-1 --1:-5:1 --1:-4:-1 --1:-3:1 --1:-2:-1 --1:-1:1 --1:0:1 --1:1:-1 --1:2:1 --1:3:-1 --1:4:1 --1:5:-1 --1:6:1 --1:7:-1 --1:8:1 --1:9:-1 --1:10:1 --1:11:-1 --1:12:1 --1:13:-1 --1:14:1 --1:15:-1 - -# n = 0, k = n - 15 ... n + 15 - -0:-15:0 -0:-14:0 -0:-13:0 -0:-12:0 -0:-11:0 -0:-10:0 -0:-9:0 -0:-8:0 -0:-7:0 -0:-6:0 -0:-5:0 -0:-4:0 -0:-3:0 -0:-2:0 -0:-1:0 -0:0:1 -0:1:0 -0:2:0 -0:3:0 -0:4:0 -0:5:0 -0:6:0 -0:7:0 -0:8:0 -0:9:0 -0:10:0 -0:11:0 -0:12:0 -0:13:0 -0:14:0 -0:15:0 - -# n = 1, k = n - 15 ... n + 15 - -1:-15:0 -1:-14:0 -1:-13:0 -1:-12:0 -1:-11:0 -1:-10:0 -1:-9:0 -1:-8:0 -1:-7:0 -1:-6:0 -1:-5:0 -1:-4:0 -1:-3:0 -1:-2:0 -1:-1:0 -1:0:1 -1:1:1 -1:2:0 -1:3:0 -1:4:0 -1:5:0 -1:6:0 -1:7:0 -1:8:0 -1:9:0 -1:10:0 -1:11:0 -1:12:0 -1:13:0 -1:14:0 -1:15:0 -1:16:0 - -# n = 2, k = n - 15 ... n + 15 - -2:-15:0 -2:-14:0 -2:-13:0 -2:-12:0 -2:-11:0 -2:-10:0 -2:-9:0 -2:-8:0 -2:-7:0 -2:-6:0 -2:-5:0 -2:-4:0 -2:-3:0 -2:-2:0 -2:-1:0 -2:0:1 -2:1:2 -2:2:1 -2:3:0 -2:4:0 -2:5:0 -2:6:0 -2:7:0 -2:8:0 -2:9:0 -2:10:0 -2:11:0 -2:12:0 -2:13:0 -2:14:0 -2:15:0 -2:16:0 -2:17:0 - -# n = 3, k = n - 15 ... n + 15 - -3:-15:0 -3:-14:0 -3:-13:0 -3:-12:0 -3:-11:0 -3:-10:0 -3:-9:0 -3:-8:0 -3:-7:0 -3:-6:0 -3:-5:0 -3:-4:0 -3:-3:0 -3:-2:0 -3:-1:0 -3:0:1 -3:1:3 -3:2:3 -3:3:1 -3:4:0 -3:5:0 -3:6:0 -3:7:0 -3:8:0 -3:9:0 -3:10:0 -3:11:0 -3:12:0 -3:13:0 -3:14:0 -3:15:0 -3:16:0 -3:17:0 -3:18:0 - -# n = 4, k = n - 15 ... n + 15 - -4:-15:0 -4:-14:0 -4:-13:0 -4:-12:0 -4:-11:0 -4:-10:0 -4:-9:0 -4:-8:0 -4:-7:0 -4:-6:0 -4:-5:0 -4:-4:0 -4:-3:0 -4:-2:0 -4:-1:0 -4:0:1 -4:1:4 -4:2:6 -4:3:4 -4:4:1 -4:5:0 -4:6:0 -4:7:0 -4:8:0 -4:9:0 -4:10:0 -4:11:0 -4:12:0 -4:13:0 -4:14:0 -4:15:0 -4:16:0 -4:17:0 -4:18:0 -4:19:0 - -# n = 5, k = n - 15 ... n + 15 - -5:-15:0 -5:-14:0 -5:-13:0 -5:-12:0 -5:-11:0 -5:-10:0 -5:-9:0 -5:-8:0 -5:-7:0 -5:-6:0 -5:-5:0 -5:-4:0 -5:-3:0 -5:-2:0 -5:-1:0 -5:0:1 -5:1:5 -5:2:10 -5:3:10 -5:4:5 -5:5:1 -5:6:0 -5:7:0 -5:8:0 -5:9:0 -5:10:0 -5:11:0 -5:12:0 -5:13:0 -5:14:0 -5:15:0 -5:16:0 -5:17:0 -5:18:0 -5:19:0 -5:20:0 - -# n = 6, k = n - 15 ... n + 15 - -6:-15:0 -6:-14:0 -6:-13:0 -6:-12:0 -6:-11:0 -6:-10:0 -6:-9:0 -6:-8:0 -6:-7:0 -6:-6:0 -6:-5:0 -6:-4:0 -6:-3:0 -6:-2:0 -6:-1:0 -6:0:1 -6:1:6 -6:2:15 -6:3:20 -6:4:15 -6:5:6 -6:6:1 -6:7:0 -6:8:0 -6:9:0 -6:10:0 -6:11:0 -6:12:0 -6:13:0 -6:14:0 -6:15:0 -6:16:0 -6:17:0 -6:18:0 -6:19:0 -6:20:0 -6:21:0 - -# n = 7, k = n - 15 ... n + 15 - -7:-15:0 -7:-14:0 -7:-13:0 -7:-12:0 -7:-11:0 -7:-10:0 -7:-9:0 -7:-8:0 -7:-7:0 -7:-6:0 -7:-5:0 -7:-4:0 -7:-3:0 -7:-2:0 -7:-1:0 -7:0:1 -7:1:7 -7:2:21 -7:3:35 -7:4:35 -7:5:21 -7:6:7 -7:7:1 -7:8:0 -7:9:0 -7:10:0 -7:11:0 -7:12:0 -7:13:0 -7:14:0 -7:15:0 -7:16:0 -7:17:0 -7:18:0 -7:19:0 -7:20:0 -7:21:0 -7:22:0 - -# n = 8, k = n - 15 ... n + 15 - -8:-15:0 -8:-14:0 -8:-13:0 -8:-12:0 -8:-11:0 -8:-10:0 -8:-9:0 -8:-8:0 -8:-7:0 -8:-6:0 -8:-5:0 -8:-4:0 -8:-3:0 -8:-2:0 -8:-1:0 -8:0:1 -8:1:8 -8:2:28 -8:3:56 -8:4:70 -8:5:56 -8:6:28 -8:7:8 -8:8:1 -8:9:0 -8:10:0 -8:11:0 -8:12:0 -8:13:0 -8:14:0 -8:15:0 -8:16:0 -8:17:0 -8:18:0 -8:19:0 -8:20:0 -8:21:0 -8:22:0 -8:23:0 - -# n = 9, k = n - 15 ... n + 15 - -9:-15:0 -9:-14:0 -9:-13:0 -9:-12:0 -9:-11:0 -9:-10:0 -9:-9:0 -9:-8:0 -9:-7:0 -9:-6:0 -9:-5:0 -9:-4:0 -9:-3:0 -9:-2:0 -9:-1:0 -9:0:1 -9:1:9 -9:2:36 -9:3:84 -9:4:126 -9:5:126 -9:6:84 -9:7:36 -9:8:9 -9:9:1 -9:10:0 -9:11:0 -9:12:0 -9:13:0 -9:14:0 -9:15:0 -9:16:0 -9:17:0 -9:18:0 -9:19:0 -9:20:0 -9:21:0 -9:22:0 -9:23:0 -9:24:0 - -# n = 10, k = n - 15 ... n + 15 - -10:-15:0 -10:-14:0 -10:-13:0 -10:-12:0 -10:-11:0 -10:-10:0 -10:-9:0 -10:-8:0 -10:-7:0 -10:-6:0 -10:-5:0 -10:-4:0 -10:-3:0 -10:-2:0 -10:-1:0 -10:0:1 -10:1:10 -10:2:45 -10:3:120 -10:4:210 -10:5:252 -10:6:210 -10:7:120 -10:8:45 -10:9:10 -10:10:1 -10:11:0 -10:12:0 -10:13:0 -10:14:0 -10:15:0 -10:16:0 -10:17:0 -10:18:0 -10:19:0 -10:20:0 -10:21:0 -10:22:0 -10:23:0 -10:24:0 -10:25:0 - -# n = 11, k = n - 15 ... n + 15 - -11:-15:0 -11:-14:0 -11:-13:0 -11:-12:0 -11:-11:0 -11:-10:0 -11:-9:0 -11:-8:0 -11:-7:0 -11:-6:0 -11:-5:0 -11:-4:0 -11:-3:0 -11:-2:0 -11:-1:0 -11:0:1 -11:1:11 -11:2:55 -11:3:165 -11:4:330 -11:5:462 -11:6:462 -11:7:330 -11:8:165 -11:9:55 -11:10:11 -11:11:1 -11:12:0 -11:13:0 -11:14:0 -11:15:0 -11:16:0 -11:17:0 -11:18:0 -11:19:0 -11:20:0 -11:21:0 -11:22:0 -11:23:0 -11:24:0 -11:25:0 -11:26:0 - -# n = 12, k = n - 15 ... n + 15 - -12:-15:0 -12:-14:0 -12:-13:0 -12:-12:0 -12:-11:0 -12:-10:0 -12:-9:0 -12:-8:0 -12:-7:0 -12:-6:0 -12:-5:0 -12:-4:0 -12:-3:0 -12:-2:0 -12:-1:0 -12:0:1 -12:1:12 -12:2:66 -12:3:220 -12:4:495 -12:5:792 -12:6:924 -12:7:792 -12:8:495 -12:9:220 -12:10:66 -12:11:12 -12:12:1 -12:13:0 -12:14:0 -12:15:0 -12:16:0 -12:17:0 -12:18:0 -12:19:0 -12:20:0 -12:21:0 -12:22:0 -12:23:0 -12:24:0 -12:25:0 -12:26:0 -12:27:0 - -# n = 13, k = n - 15 ... n + 15 - -13:-15:0 -13:-14:0 -13:-13:0 -13:-12:0 -13:-11:0 -13:-10:0 -13:-9:0 -13:-8:0 -13:-7:0 -13:-6:0 -13:-5:0 -13:-4:0 -13:-3:0 -13:-2:0 -13:-1:0 -13:0:1 -13:1:13 -13:2:78 -13:3:286 -13:4:715 -13:5:1287 -13:6:1716 -13:7:1716 -13:8:1287 -13:9:715 -13:10:286 -13:11:78 -13:12:13 -13:13:1 -13:14:0 -13:15:0 -13:16:0 -13:17:0 -13:18:0 -13:19:0 -13:20:0 -13:21:0 -13:22:0 -13:23:0 -13:24:0 -13:25:0 -13:26:0 -13:27:0 -13:28:0 - -# n = 14, k = n - 15 ... n + 15 - -14:-15:0 -14:-14:0 -14:-13:0 -14:-12:0 -14:-11:0 -14:-10:0 -14:-9:0 -14:-8:0 -14:-7:0 -14:-6:0 -14:-5:0 -14:-4:0 -14:-3:0 -14:-2:0 -14:-1:0 -14:0:1 -14:1:14 -14:2:91 -14:3:364 -14:4:1001 -14:5:2002 -14:6:3003 -14:7:3432 -14:8:3003 -14:9:2002 -14:10:1001 -14:11:364 -14:12:91 -14:13:14 -14:14:1 -14:15:0 -14:16:0 -14:17:0 -14:18:0 -14:19:0 -14:20:0 -14:21:0 -14:22:0 -14:23:0 -14:24:0 -14:25:0 -14:26:0 -14:27:0 -14:28:0 -14:29:0 - -# n = 15, k = n - 15 ... n + 15 - -15:-15:0 -15:-14:0 -15:-13:0 -15:-12:0 -15:-11:0 -15:-10:0 -15:-9:0 -15:-8:0 -15:-7:0 -15:-6:0 -15:-5:0 -15:-4:0 -15:-3:0 -15:-2:0 -15:-1:0 -15:0:1 -15:1:15 -15:2:105 -15:3:455 -15:4:1365 -15:5:3003 -15:6:5005 -15:7:6435 -15:8:6435 -15:9:5005 -15:10:3003 -15:11:1365 -15:12:455 -15:13:105 -15:14:15 -15:15:1 -15:16:0 -15:17:0 -15:18:0 -15:19:0 -15:20:0 -15:21:0 -15:22:0 -15:23:0 -15:24:0 -15:25:0 -15:26:0 -15:27:0 -15:28:0 -15:29:0 -15:30:0 diff --git a/cpan/Math-BigInt/t/bnok-mbi.t b/cpan/Math-BigInt/t/bnok-mbi.t deleted file mode 100644 index 26fe2ffa67..0000000000 --- a/cpan/Math-BigInt/t/bnok-mbi.t +++ /dev/null @@ -1,1451 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 4957; - -my $class; - -BEGIN { - $class = 'Math::BigInt'; - use_ok($class); -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($nval, $kval, $nokval) = split /:/; - my ($n, $k, $got, @got); - - for my $context_is_scalar (0, 1) { - for my $k_is_scalar (0, 1) { - - my $test = qq|\$n = $class -> new("$nval");|; - - $test .= $k_is_scalar - ? qq| \$k = "$kval";| - : qq| \$k = $class -> new("$kval");|; - - $test .= $context_is_scalar - ? qq| \$got = \$n -> bnok(\$k);| - : qq| \@got = \$n -> bnok(\$k);|; - - my $desc = "bnok() in "; - $desc .= $context_is_scalar ? "scalar context" : "list context"; - $desc .= $k_is_scalar ? " with k as scalar" : " with k as object"; - - subtest $desc, - sub { - plan tests => $context_is_scalar ? 7 : 8; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - if ($context_is_scalar) { - - # Check output. - - is(ref($got), $class, - "'$test' output arg is a $class"); - - is($got -> bstr(), $nokval, - "'$test' output arg has the right value"); - - } else { - - # Check number of output arguments. - - cmp_ok(scalar @got, '==', 1, - "'$test' gives one output arg"); - - # Check output. - - is(ref($got[0]), $class, - "'$test' output arg is a $class"); - - is($got[0] -> bstr(), $nokval, - "'$test' output arg has the right value"); - } - - # Check the invocand. - - is(ref($n), $class, - "'$test' invocand is still a $class"); - - is($n -> bstr(), $nokval, - "'$test' invocand has the right value"); - - # Check the input argument. - - if ($k_is_scalar) { - - is(ref($k), '', - "'$test' second input arg is still a scalar"); - - is($k, $kval, - "'$test' second input arg is unmodified"); - - } else { - - is(ref($k), $class, - "'$test' second input arg is still a $class"); - - is($k -> bstr(), $kval, - "'$test' second input arg is unmodified"); - } - }; - } - } -} - -__DATA__ - -# n and/or k is NaN - -NaN:NaN:NaN -NaN:0:NaN -NaN:3:NaN -3:NaN:NaN -NaN:-3:NaN --3:NaN:NaN - -# n = inf - -inf:-inf:NaN -inf:-3:0 -inf:-2:0 -inf:-1:0 -inf:0:1 -inf:1:inf -inf:2:inf -inf:3:inf -inf:inf:NaN - -# n = -inf - --inf:-inf:NaN --inf:-3:0 --inf:-2:0 --inf:-1:0 --inf:0:1 --inf:1:-inf --inf:2:inf --inf:3:-inf --inf:inf:NaN - -# k = inf - --3:inf:NaN --2:inf:NaN --1:inf:NaN -0:inf:NaN -1:inf:NaN -2:inf:NaN -3:inf:NaN - -# k = -inf - --3:-inf:NaN --2:-inf:NaN --1:-inf:NaN -0:-inf:NaN -1:-inf:NaN -2:-inf:NaN -3:-inf:NaN - -# n = -15, k = n - 15 ... n + 15 - --15:-30:-77558760 --15:-29:40116600 --15:-28:-20058300 --15:-27:9657700 --15:-26:-4457400 --15:-25:1961256 --15:-24:-817190 --15:-23:319770 --15:-22:-116280 --15:-21:38760 --15:-20:-11628 --15:-19:3060 --15:-18:-680 --15:-17:120 --15:-16:-15 --15:-15:1 --15:-14:0 --15:-13:0 --15:-12:0 --15:-11:0 --15:-10:0 --15:-9:0 --15:-8:0 --15:-7:0 --15:-6:0 --15:-5:0 --15:-4:0 --15:-3:0 --15:-2:0 --15:-1:0 --15:0:1 --15:1:-15 --15:2:120 --15:3:-680 --15:4:3060 --15:5:-11628 --15:6:38760 --15:7:-116280 --15:8:319770 --15:9:-817190 --15:10:1961256 --15:11:-4457400 --15:12:9657700 --15:13:-20058300 --15:14:40116600 --15:15:-77558760 - -# n = -14, k = n - 15 ... n + 15 - --14:-29:-37442160 --14:-28:20058300 --14:-27:-10400600 --14:-26:5200300 --14:-25:-2496144 --14:-24:1144066 --14:-23:-497420 --14:-22:203490 --14:-21:-77520 --14:-20:27132 --14:-19:-8568 --14:-18:2380 --14:-17:-560 --14:-16:105 --14:-15:-14 --14:-14:1 --14:-13:0 --14:-12:0 --14:-11:0 --14:-10:0 --14:-9:0 --14:-8:0 --14:-7:0 --14:-6:0 --14:-5:0 --14:-4:0 --14:-3:0 --14:-2:0 --14:-1:0 --14:0:1 --14:1:-14 --14:2:105 --14:3:-560 --14:4:2380 --14:5:-8568 --14:6:27132 --14:7:-77520 --14:8:203490 --14:9:-497420 --14:10:1144066 --14:11:-2496144 --14:12:5200300 --14:13:-10400600 --14:14:20058300 --14:15:-37442160 - -# n = -13, k = n - 15 ... n + 15 - --13:-28:-17383860 --13:-27:9657700 --13:-26:-5200300 --13:-25:2704156 --13:-24:-1352078 --13:-23:646646 --13:-22:-293930 --13:-21:125970 --13:-20:-50388 --13:-19:18564 --13:-18:-6188 --13:-17:1820 --13:-16:-455 --13:-15:91 --13:-14:-13 --13:-13:1 --13:-12:0 --13:-11:0 --13:-10:0 --13:-9:0 --13:-8:0 --13:-7:0 --13:-6:0 --13:-5:0 --13:-4:0 --13:-3:0 --13:-2:0 --13:-1:0 --13:0:1 --13:1:-13 --13:2:91 --13:3:-455 --13:4:1820 --13:5:-6188 --13:6:18564 --13:7:-50388 --13:8:125970 --13:9:-293930 --13:10:646646 --13:11:-1352078 --13:12:2704156 --13:13:-5200300 --13:14:9657700 --13:15:-17383860 - -# n = -12, k = n - 15 ... n + 15 - --12:-27:-7726160 --12:-26:4457400 --12:-25:-2496144 --12:-24:1352078 --12:-23:-705432 --12:-22:352716 --12:-21:-167960 --12:-20:75582 --12:-19:-31824 --12:-18:12376 --12:-17:-4368 --12:-16:1365 --12:-15:-364 --12:-14:78 --12:-13:-12 --12:-12:1 --12:-11:0 --12:-10:0 --12:-9:0 --12:-8:0 --12:-7:0 --12:-6:0 --12:-5:0 --12:-4:0 --12:-3:0 --12:-2:0 --12:-1:0 --12:0:1 --12:1:-12 --12:2:78 --12:3:-364 --12:4:1365 --12:5:-4368 --12:6:12376 --12:7:-31824 --12:8:75582 --12:9:-167960 --12:10:352716 --12:11:-705432 --12:12:1352078 --12:13:-2496144 --12:14:4457400 --12:15:-7726160 - -# n = -11, k = n - 15 ... n + 15 - --11:-26:-3268760 --11:-25:1961256 --11:-24:-1144066 --11:-23:646646 --11:-22:-352716 --11:-21:184756 --11:-20:-92378 --11:-19:43758 --11:-18:-19448 --11:-17:8008 --11:-16:-3003 --11:-15:1001 --11:-14:-286 --11:-13:66 --11:-12:-11 --11:-11:1 --11:-10:0 --11:-9:0 --11:-8:0 --11:-7:0 --11:-6:0 --11:-5:0 --11:-4:0 --11:-3:0 --11:-2:0 --11:-1:0 --11:0:1 --11:1:-11 --11:2:66 --11:3:-286 --11:4:1001 --11:5:-3003 --11:6:8008 --11:7:-19448 --11:8:43758 --11:9:-92378 --11:10:184756 --11:11:-352716 --11:12:646646 --11:13:-1144066 --11:14:1961256 --11:15:-3268760 - -# n = -10, k = n - 15 ... n + 15 - --10:-25:-1307504 --10:-24:817190 --10:-23:-497420 --10:-22:293930 --10:-21:-167960 --10:-20:92378 --10:-19:-48620 --10:-18:24310 --10:-17:-11440 --10:-16:5005 --10:-15:-2002 --10:-14:715 --10:-13:-220 --10:-12:55 --10:-11:-10 --10:-10:1 --10:-9:0 --10:-8:0 --10:-7:0 --10:-6:0 --10:-5:0 --10:-4:0 --10:-3:0 --10:-2:0 --10:-1:0 --10:0:1 --10:1:-10 --10:2:55 --10:3:-220 --10:4:715 --10:5:-2002 --10:6:5005 --10:7:-11440 --10:8:24310 --10:9:-48620 --10:10:92378 --10:11:-167960 --10:12:293930 --10:13:-497420 --10:14:817190 --10:15:-1307504 - -# n = -9, k = n - 15 ... n + 15 - --9:-24:-490314 --9:-23:319770 --9:-22:-203490 --9:-21:125970 --9:-20:-75582 --9:-19:43758 --9:-18:-24310 --9:-17:12870 --9:-16:-6435 --9:-15:3003 --9:-14:-1287 --9:-13:495 --9:-12:-165 --9:-11:45 --9:-10:-9 --9:-9:1 --9:-8:0 --9:-7:0 --9:-6:0 --9:-5:0 --9:-4:0 --9:-3:0 --9:-2:0 --9:-1:0 --9:0:1 --9:1:-9 --9:2:45 --9:3:-165 --9:4:495 --9:5:-1287 --9:6:3003 --9:7:-6435 --9:8:12870 --9:9:-24310 --9:10:43758 --9:11:-75582 --9:12:125970 --9:13:-203490 --9:14:319770 --9:15:-490314 - -# n = -8, k = n - 15 ... n + 15 - --8:-23:-170544 --8:-22:116280 --8:-21:-77520 --8:-20:50388 --8:-19:-31824 --8:-18:19448 --8:-17:-11440 --8:-16:6435 --8:-15:-3432 --8:-14:1716 --8:-13:-792 --8:-12:330 --8:-11:-120 --8:-10:36 --8:-9:-8 --8:-8:1 --8:-7:0 --8:-6:0 --8:-5:0 --8:-4:0 --8:-3:0 --8:-2:0 --8:-1:0 --8:0:1 --8:1:-8 --8:2:36 --8:3:-120 --8:4:330 --8:5:-792 --8:6:1716 --8:7:-3432 --8:8:6435 --8:9:-11440 --8:10:19448 --8:11:-31824 --8:12:50388 --8:13:-77520 --8:14:116280 --8:15:-170544 - -# n = -7, k = n - 15 ... n + 15 - --7:-22:-54264 --7:-21:38760 --7:-20:-27132 --7:-19:18564 --7:-18:-12376 --7:-17:8008 --7:-16:-5005 --7:-15:3003 --7:-14:-1716 --7:-13:924 --7:-12:-462 --7:-11:210 --7:-10:-84 --7:-9:28 --7:-8:-7 --7:-7:1 --7:-6:0 --7:-5:0 --7:-4:0 --7:-3:0 --7:-2:0 --7:-1:0 --7:0:1 --7:1:-7 --7:2:28 --7:3:-84 --7:4:210 --7:5:-462 --7:6:924 --7:7:-1716 --7:8:3003 --7:9:-5005 --7:10:8008 --7:11:-12376 --7:12:18564 --7:13:-27132 --7:14:38760 --7:15:-54264 - -# n = -6, k = n - 15 ... n + 15 - --6:-21:-15504 --6:-20:11628 --6:-19:-8568 --6:-18:6188 --6:-17:-4368 --6:-16:3003 --6:-15:-2002 --6:-14:1287 --6:-13:-792 --6:-12:462 --6:-11:-252 --6:-10:126 --6:-9:-56 --6:-8:21 --6:-7:-6 --6:-6:1 --6:-5:0 --6:-4:0 --6:-3:0 --6:-2:0 --6:-1:0 --6:0:1 --6:1:-6 --6:2:21 --6:3:-56 --6:4:126 --6:5:-252 --6:6:462 --6:7:-792 --6:8:1287 --6:9:-2002 --6:10:3003 --6:11:-4368 --6:12:6188 --6:13:-8568 --6:14:11628 --6:15:-15504 - -# n = -5, k = n - 15 ... n + 15 - --5:-20:-3876 --5:-19:3060 --5:-18:-2380 --5:-17:1820 --5:-16:-1365 --5:-15:1001 --5:-14:-715 --5:-13:495 --5:-12:-330 --5:-11:210 --5:-10:-126 --5:-9:70 --5:-8:-35 --5:-7:15 --5:-6:-5 --5:-5:1 --5:-4:0 --5:-3:0 --5:-2:0 --5:-1:0 --5:0:1 --5:1:-5 --5:2:15 --5:3:-35 --5:4:70 --5:5:-126 --5:6:210 --5:7:-330 --5:8:495 --5:9:-715 --5:10:1001 --5:11:-1365 --5:12:1820 --5:13:-2380 --5:14:3060 --5:15:-3876 - -# n = -4, k = n - 15 ... n + 15 - --4:-19:-816 --4:-18:680 --4:-17:-560 --4:-16:455 --4:-15:-364 --4:-14:286 --4:-13:-220 --4:-12:165 --4:-11:-120 --4:-10:84 --4:-9:-56 --4:-8:35 --4:-7:-20 --4:-6:10 --4:-5:-4 --4:-4:1 --4:-3:0 --4:-2:0 --4:-1:0 --4:0:1 --4:1:-4 --4:2:10 --4:3:-20 --4:4:35 --4:5:-56 --4:6:84 --4:7:-120 --4:8:165 --4:9:-220 --4:10:286 --4:11:-364 --4:12:455 --4:13:-560 --4:14:680 --4:15:-816 - -# n = -3, k = n - 15 ... n + 15 - --3:-18:-136 --3:-17:120 --3:-16:-105 --3:-15:91 --3:-14:-78 --3:-13:66 --3:-12:-55 --3:-11:45 --3:-10:-36 --3:-9:28 --3:-8:-21 --3:-7:15 --3:-6:-10 --3:-5:6 --3:-4:-3 --3:-3:1 --3:-2:0 --3:-1:0 --3:0:1 --3:1:-3 --3:2:6 --3:3:-10 --3:4:15 --3:5:-21 --3:6:28 --3:7:-36 --3:8:45 --3:9:-55 --3:10:66 --3:11:-78 --3:12:91 --3:13:-105 --3:14:120 --3:15:-136 - -# n = -2, k = n - 15 ... n + 15 - --2:-17:-16 --2:-16:15 --2:-15:-14 --2:-14:13 --2:-13:-12 --2:-12:11 --2:-11:-10 --2:-10:9 --2:-9:-8 --2:-8:7 --2:-7:-6 --2:-6:5 --2:-5:-4 --2:-4:3 --2:-3:-2 --2:-2:1 --2:-1:0 --2:0:1 --2:1:-2 --2:2:3 --2:3:-4 --2:4:5 --2:5:-6 --2:6:7 --2:7:-8 --2:8:9 --2:9:-10 --2:10:11 --2:11:-12 --2:12:13 --2:13:-14 --2:14:15 --2:15:-16 - -# n = -1, k = n - 15 ... n + 15 - --1:-16:-1 --1:-15:1 --1:-14:-1 --1:-13:1 --1:-12:-1 --1:-11:1 --1:-10:-1 --1:-9:1 --1:-8:-1 --1:-7:1 --1:-6:-1 --1:-5:1 --1:-4:-1 --1:-3:1 --1:-2:-1 --1:-1:1 --1:0:1 --1:1:-1 --1:2:1 --1:3:-1 --1:4:1 --1:5:-1 --1:6:1 --1:7:-1 --1:8:1 --1:9:-1 --1:10:1 --1:11:-1 --1:12:1 --1:13:-1 --1:14:1 --1:15:-1 - -# n = 0, k = n - 15 ... n + 15 - -0:-15:0 -0:-14:0 -0:-13:0 -0:-12:0 -0:-11:0 -0:-10:0 -0:-9:0 -0:-8:0 -0:-7:0 -0:-6:0 -0:-5:0 -0:-4:0 -0:-3:0 -0:-2:0 -0:-1:0 -0:0:1 -0:1:0 -0:2:0 -0:3:0 -0:4:0 -0:5:0 -0:6:0 -0:7:0 -0:8:0 -0:9:0 -0:10:0 -0:11:0 -0:12:0 -0:13:0 -0:14:0 -0:15:0 - -# n = 1, k = n - 15 ... n + 15 - -1:-15:0 -1:-14:0 -1:-13:0 -1:-12:0 -1:-11:0 -1:-10:0 -1:-9:0 -1:-8:0 -1:-7:0 -1:-6:0 -1:-5:0 -1:-4:0 -1:-3:0 -1:-2:0 -1:-1:0 -1:0:1 -1:1:1 -1:2:0 -1:3:0 -1:4:0 -1:5:0 -1:6:0 -1:7:0 -1:8:0 -1:9:0 -1:10:0 -1:11:0 -1:12:0 -1:13:0 -1:14:0 -1:15:0 -1:16:0 - -# n = 2, k = n - 15 ... n + 15 - -2:-15:0 -2:-14:0 -2:-13:0 -2:-12:0 -2:-11:0 -2:-10:0 -2:-9:0 -2:-8:0 -2:-7:0 -2:-6:0 -2:-5:0 -2:-4:0 -2:-3:0 -2:-2:0 -2:-1:0 -2:0:1 -2:1:2 -2:2:1 -2:3:0 -2:4:0 -2:5:0 -2:6:0 -2:7:0 -2:8:0 -2:9:0 -2:10:0 -2:11:0 -2:12:0 -2:13:0 -2:14:0 -2:15:0 -2:16:0 -2:17:0 - -# n = 3, k = n - 15 ... n + 15 - -3:-15:0 -3:-14:0 -3:-13:0 -3:-12:0 -3:-11:0 -3:-10:0 -3:-9:0 -3:-8:0 -3:-7:0 -3:-6:0 -3:-5:0 -3:-4:0 -3:-3:0 -3:-2:0 -3:-1:0 -3:0:1 -3:1:3 -3:2:3 -3:3:1 -3:4:0 -3:5:0 -3:6:0 -3:7:0 -3:8:0 -3:9:0 -3:10:0 -3:11:0 -3:12:0 -3:13:0 -3:14:0 -3:15:0 -3:16:0 -3:17:0 -3:18:0 - -# n = 4, k = n - 15 ... n + 15 - -4:-15:0 -4:-14:0 -4:-13:0 -4:-12:0 -4:-11:0 -4:-10:0 -4:-9:0 -4:-8:0 -4:-7:0 -4:-6:0 -4:-5:0 -4:-4:0 -4:-3:0 -4:-2:0 -4:-1:0 -4:0:1 -4:1:4 -4:2:6 -4:3:4 -4:4:1 -4:5:0 -4:6:0 -4:7:0 -4:8:0 -4:9:0 -4:10:0 -4:11:0 -4:12:0 -4:13:0 -4:14:0 -4:15:0 -4:16:0 -4:17:0 -4:18:0 -4:19:0 - -# n = 5, k = n - 15 ... n + 15 - -5:-15:0 -5:-14:0 -5:-13:0 -5:-12:0 -5:-11:0 -5:-10:0 -5:-9:0 -5:-8:0 -5:-7:0 -5:-6:0 -5:-5:0 -5:-4:0 -5:-3:0 -5:-2:0 -5:-1:0 -5:0:1 -5:1:5 -5:2:10 -5:3:10 -5:4:5 -5:5:1 -5:6:0 -5:7:0 -5:8:0 -5:9:0 -5:10:0 -5:11:0 -5:12:0 -5:13:0 -5:14:0 -5:15:0 -5:16:0 -5:17:0 -5:18:0 -5:19:0 -5:20:0 - -# n = 6, k = n - 15 ... n + 15 - -6:-15:0 -6:-14:0 -6:-13:0 -6:-12:0 -6:-11:0 -6:-10:0 -6:-9:0 -6:-8:0 -6:-7:0 -6:-6:0 -6:-5:0 -6:-4:0 -6:-3:0 -6:-2:0 -6:-1:0 -6:0:1 -6:1:6 -6:2:15 -6:3:20 -6:4:15 -6:5:6 -6:6:1 -6:7:0 -6:8:0 -6:9:0 -6:10:0 -6:11:0 -6:12:0 -6:13:0 -6:14:0 -6:15:0 -6:16:0 -6:17:0 -6:18:0 -6:19:0 -6:20:0 -6:21:0 - -# n = 7, k = n - 15 ... n + 15 - -7:-15:0 -7:-14:0 -7:-13:0 -7:-12:0 -7:-11:0 -7:-10:0 -7:-9:0 -7:-8:0 -7:-7:0 -7:-6:0 -7:-5:0 -7:-4:0 -7:-3:0 -7:-2:0 -7:-1:0 -7:0:1 -7:1:7 -7:2:21 -7:3:35 -7:4:35 -7:5:21 -7:6:7 -7:7:1 -7:8:0 -7:9:0 -7:10:0 -7:11:0 -7:12:0 -7:13:0 -7:14:0 -7:15:0 -7:16:0 -7:17:0 -7:18:0 -7:19:0 -7:20:0 -7:21:0 -7:22:0 - -# n = 8, k = n - 15 ... n + 15 - -8:-15:0 -8:-14:0 -8:-13:0 -8:-12:0 -8:-11:0 -8:-10:0 -8:-9:0 -8:-8:0 -8:-7:0 -8:-6:0 -8:-5:0 -8:-4:0 -8:-3:0 -8:-2:0 -8:-1:0 -8:0:1 -8:1:8 -8:2:28 -8:3:56 -8:4:70 -8:5:56 -8:6:28 -8:7:8 -8:8:1 -8:9:0 -8:10:0 -8:11:0 -8:12:0 -8:13:0 -8:14:0 -8:15:0 -8:16:0 -8:17:0 -8:18:0 -8:19:0 -8:20:0 -8:21:0 -8:22:0 -8:23:0 - -# n = 9, k = n - 15 ... n + 15 - -9:-15:0 -9:-14:0 -9:-13:0 -9:-12:0 -9:-11:0 -9:-10:0 -9:-9:0 -9:-8:0 -9:-7:0 -9:-6:0 -9:-5:0 -9:-4:0 -9:-3:0 -9:-2:0 -9:-1:0 -9:0:1 -9:1:9 -9:2:36 -9:3:84 -9:4:126 -9:5:126 -9:6:84 -9:7:36 -9:8:9 -9:9:1 -9:10:0 -9:11:0 -9:12:0 -9:13:0 -9:14:0 -9:15:0 -9:16:0 -9:17:0 -9:18:0 -9:19:0 -9:20:0 -9:21:0 -9:22:0 -9:23:0 -9:24:0 - -# n = 10, k = n - 15 ... n + 15 - -10:-15:0 -10:-14:0 -10:-13:0 -10:-12:0 -10:-11:0 -10:-10:0 -10:-9:0 -10:-8:0 -10:-7:0 -10:-6:0 -10:-5:0 -10:-4:0 -10:-3:0 -10:-2:0 -10:-1:0 -10:0:1 -10:1:10 -10:2:45 -10:3:120 -10:4:210 -10:5:252 -10:6:210 -10:7:120 -10:8:45 -10:9:10 -10:10:1 -10:11:0 -10:12:0 -10:13:0 -10:14:0 -10:15:0 -10:16:0 -10:17:0 -10:18:0 -10:19:0 -10:20:0 -10:21:0 -10:22:0 -10:23:0 -10:24:0 -10:25:0 - -# n = 11, k = n - 15 ... n + 15 - -11:-15:0 -11:-14:0 -11:-13:0 -11:-12:0 -11:-11:0 -11:-10:0 -11:-9:0 -11:-8:0 -11:-7:0 -11:-6:0 -11:-5:0 -11:-4:0 -11:-3:0 -11:-2:0 -11:-1:0 -11:0:1 -11:1:11 -11:2:55 -11:3:165 -11:4:330 -11:5:462 -11:6:462 -11:7:330 -11:8:165 -11:9:55 -11:10:11 -11:11:1 -11:12:0 -11:13:0 -11:14:0 -11:15:0 -11:16:0 -11:17:0 -11:18:0 -11:19:0 -11:20:0 -11:21:0 -11:22:0 -11:23:0 -11:24:0 -11:25:0 -11:26:0 - -# n = 12, k = n - 15 ... n + 15 - -12:-15:0 -12:-14:0 -12:-13:0 -12:-12:0 -12:-11:0 -12:-10:0 -12:-9:0 -12:-8:0 -12:-7:0 -12:-6:0 -12:-5:0 -12:-4:0 -12:-3:0 -12:-2:0 -12:-1:0 -12:0:1 -12:1:12 -12:2:66 -12:3:220 -12:4:495 -12:5:792 -12:6:924 -12:7:792 -12:8:495 -12:9:220 -12:10:66 -12:11:12 -12:12:1 -12:13:0 -12:14:0 -12:15:0 -12:16:0 -12:17:0 -12:18:0 -12:19:0 -12:20:0 -12:21:0 -12:22:0 -12:23:0 -12:24:0 -12:25:0 -12:26:0 -12:27:0 - -# n = 13, k = n - 15 ... n + 15 - -13:-15:0 -13:-14:0 -13:-13:0 -13:-12:0 -13:-11:0 -13:-10:0 -13:-9:0 -13:-8:0 -13:-7:0 -13:-6:0 -13:-5:0 -13:-4:0 -13:-3:0 -13:-2:0 -13:-1:0 -13:0:1 -13:1:13 -13:2:78 -13:3:286 -13:4:715 -13:5:1287 -13:6:1716 -13:7:1716 -13:8:1287 -13:9:715 -13:10:286 -13:11:78 -13:12:13 -13:13:1 -13:14:0 -13:15:0 -13:16:0 -13:17:0 -13:18:0 -13:19:0 -13:20:0 -13:21:0 -13:22:0 -13:23:0 -13:24:0 -13:25:0 -13:26:0 -13:27:0 -13:28:0 - -# n = 14, k = n - 15 ... n + 15 - -14:-15:0 -14:-14:0 -14:-13:0 -14:-12:0 -14:-11:0 -14:-10:0 -14:-9:0 -14:-8:0 -14:-7:0 -14:-6:0 -14:-5:0 -14:-4:0 -14:-3:0 -14:-2:0 -14:-1:0 -14:0:1 -14:1:14 -14:2:91 -14:3:364 -14:4:1001 -14:5:2002 -14:6:3003 -14:7:3432 -14:8:3003 -14:9:2002 -14:10:1001 -14:11:364 -14:12:91 -14:13:14 -14:14:1 -14:15:0 -14:16:0 -14:17:0 -14:18:0 -14:19:0 -14:20:0 -14:21:0 -14:22:0 -14:23:0 -14:24:0 -14:25:0 -14:26:0 -14:27:0 -14:28:0 -14:29:0 - -# n = 15, k = n - 15 ... n + 15 - -15:-15:0 -15:-14:0 -15:-13:0 -15:-12:0 -15:-11:0 -15:-10:0 -15:-9:0 -15:-8:0 -15:-7:0 -15:-6:0 -15:-5:0 -15:-4:0 -15:-3:0 -15:-2:0 -15:-1:0 -15:0:1 -15:1:15 -15:2:105 -15:3:455 -15:4:1365 -15:5:3003 -15:6:5005 -15:7:6435 -15:8:6435 -15:9:5005 -15:10:3003 -15:11:1365 -15:12:455 -15:13:105 -15:14:15 -15:15:1 -15:16:0 -15:17:0 -15:18:0 -15:19:0 -15:20:0 -15:21:0 -15:22:0 -15:23:0 -15:24:0 -15:25:0 -15:26:0 -15:27:0 -15:28:0 -15:29:0 -15:30:0 diff --git a/cpan/Math-BigInt/t/bnstr-mbf.t b/cpan/Math-BigInt/t/bnstr-mbf.t deleted file mode 100644 index 9e03a5bf48..0000000000 --- a/cpan/Math-BigInt/t/bnstr-mbf.t +++ /dev/null @@ -1,278 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 460; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - { - my $test = qq|\$x = Math::BigFloat -> new("$x_str");| - . qq| \$str = \$x -> bnstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); - } - -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -0.000000000001:1e-12 -0.00000000001:1e-11 -0.0000000001:1e-10 -0.000000001:1e-9 -0.00000001:1e-8 -0.0000001:1e-7 -0.000001:1e-6 -0.00001:1e-5 -0.0001:1e-4 -0.001:1e-3 -0.01:1e-2 -0.1:1e-1 -1:1e+0 -10:1e+1 -100:1e+2 -1000:1e+3 -10000:1e+4 -100000:1e+5 -1000000:1e+6 -10000000:1e+7 -100000000:1e+8 -1000000000:1e+9 -10000000000:1e+10 -100000000000:1e+11 -1000000000000:1e+12 - -0.0000000000012:1.2e-12 -0.000000000012:1.2e-11 -0.00000000012:1.2e-10 -0.0000000012:1.2e-9 -0.000000012:1.2e-8 -0.00000012:1.2e-7 -0.0000012:1.2e-6 -0.000012:1.2e-5 -0.00012:1.2e-4 -0.0012:1.2e-3 -0.012:1.2e-2 -0.12:1.2e-1 -1.2:1.2e+0 -12:1.2e+1 -120:1.2e+2 -1200:1.2e+3 -12000:1.2e+4 -120000:1.2e+5 -1200000:1.2e+6 -12000000:1.2e+7 -120000000:1.2e+8 -1200000000:1.2e+9 -12000000000:1.2e+10 -120000000000:1.2e+11 -1200000000000:1.2e+12 - -0.00000000000123:1.23e-12 -0.0000000000123:1.23e-11 -0.000000000123:1.23e-10 -0.00000000123:1.23e-9 -0.0000000123:1.23e-8 -0.000000123:1.23e-7 -0.00000123:1.23e-6 -0.0000123:1.23e-5 -0.000123:1.23e-4 -0.00123:1.23e-3 -0.0123:1.23e-2 -0.123:1.23e-1 -1.23:1.23e+0 -12.3:1.23e+1 -123:1.23e+2 -1230:1.23e+3 -12300:1.23e+4 -123000:1.23e+5 -1230000:1.23e+6 -12300000:1.23e+7 -123000000:1.23e+8 -1230000000:1.23e+9 -12300000000:1.23e+10 -123000000000:1.23e+11 -1230000000000:1.23e+12 - -0.000000000001234:1.234e-12 -0.00000000001234:1.234e-11 -0.0000000001234:1.234e-10 -0.000000001234:1.234e-9 -0.00000001234:1.234e-8 -0.0000001234:1.234e-7 -0.000001234:1.234e-6 -0.00001234:1.234e-5 -0.0001234:1.234e-4 -0.001234:1.234e-3 -0.01234:1.234e-2 -0.1234:1.234e-1 -1.234:1.234e+0 -12.34:1.234e+1 -123.4:1.234e+2 -1234:1.234e+3 -12340:1.234e+4 -123400:1.234e+5 -1234000:1.234e+6 -12340000:1.234e+7 -123400000:1.234e+8 -1234000000:1.234e+9 -12340000000:1.234e+10 -123400000000:1.234e+11 -1234000000000:1.234e+12 - -0.000003141592:3.141592e-6 -0.00003141592:3.141592e-5 -0.0003141592:3.141592e-4 -0.003141592:3.141592e-3 -0.03141592:3.141592e-2 -0.3141592:3.141592e-1 -3.141592:3.141592e+0 -31.41592:3.141592e+1 -314.1592:3.141592e+2 -3141.592:3.141592e+3 -31415.92:3.141592e+4 -314159.2:3.141592e+5 -3141592:3.141592e+6 - -# negative numbers - --0.000000000001:-1e-12 --0.00000000001:-1e-11 --0.0000000001:-1e-10 --0.000000001:-1e-9 --0.00000001:-1e-8 --0.0000001:-1e-7 --0.000001:-1e-6 --0.00001:-1e-5 --0.0001:-1e-4 --0.001:-1e-3 --0.01:-1e-2 --0.1:-1e-1 --1:-1e+0 --10:-1e+1 --100:-1e+2 --1000:-1e+3 --10000:-1e+4 --100000:-1e+5 --1000000:-1e+6 --10000000:-1e+7 --100000000:-1e+8 --1000000000:-1e+9 --10000000000:-1e+10 --100000000000:-1e+11 --1000000000000:-1e+12 - --0.0000000000012:-1.2e-12 --0.000000000012:-1.2e-11 --0.00000000012:-1.2e-10 --0.0000000012:-1.2e-9 --0.000000012:-1.2e-8 --0.00000012:-1.2e-7 --0.0000012:-1.2e-6 --0.000012:-1.2e-5 --0.00012:-1.2e-4 --0.0012:-1.2e-3 --0.012:-1.2e-2 --0.12:-1.2e-1 --1.2:-1.2e+0 --12:-1.2e+1 --120:-1.2e+2 --1200:-1.2e+3 --12000:-1.2e+4 --120000:-1.2e+5 --1200000:-1.2e+6 --12000000:-1.2e+7 --120000000:-1.2e+8 --1200000000:-1.2e+9 --12000000000:-1.2e+10 --120000000000:-1.2e+11 --1200000000000:-1.2e+12 - --0.00000000000123:-1.23e-12 --0.0000000000123:-1.23e-11 --0.000000000123:-1.23e-10 --0.00000000123:-1.23e-9 --0.0000000123:-1.23e-8 --0.000000123:-1.23e-7 --0.00000123:-1.23e-6 --0.0000123:-1.23e-5 --0.000123:-1.23e-4 --0.00123:-1.23e-3 --0.0123:-1.23e-2 --0.123:-1.23e-1 --1.23:-1.23e+0 --12.3:-1.23e+1 --123:-1.23e+2 --1230:-1.23e+3 --12300:-1.23e+4 --123000:-1.23e+5 --1230000:-1.23e+6 --12300000:-1.23e+7 --123000000:-1.23e+8 --1230000000:-1.23e+9 --12300000000:-1.23e+10 --123000000000:-1.23e+11 --1230000000000:-1.23e+12 - --0.000000000001234:-1.234e-12 --0.00000000001234:-1.234e-11 --0.0000000001234:-1.234e-10 --0.000000001234:-1.234e-9 --0.00000001234:-1.234e-8 --0.0000001234:-1.234e-7 --0.000001234:-1.234e-6 --0.00001234:-1.234e-5 --0.0001234:-1.234e-4 --0.001234:-1.234e-3 --0.01234:-1.234e-2 --0.1234:-1.234e-1 --1.234:-1.234e+0 --12.34:-1.234e+1 --123.4:-1.234e+2 --1234:-1.234e+3 --12340:-1.234e+4 --123400:-1.234e+5 --1234000:-1.234e+6 --12340000:-1.234e+7 --123400000:-1.234e+8 --1234000000:-1.234e+9 --12340000000:-1.234e+10 --123400000000:-1.234e+11 --1234000000000:-1.234e+12 - --0.000003141592:-3.141592e-6 --0.00003141592:-3.141592e-5 --0.0003141592:-3.141592e-4 --0.003141592:-3.141592e-3 --0.03141592:-3.141592e-2 --0.3141592:-3.141592e-1 --3.141592:-3.141592e+0 --31.41592:-3.141592e+1 --314.1592:-3.141592e+2 --3141.592:-3.141592e+3 --31415.92:-3.141592e+4 --314159.2:-3.141592e+5 --3141592:-3.141592e+6 diff --git a/cpan/Math-BigInt/t/bnstr-mbi.t b/cpan/Math-BigInt/t/bnstr-mbi.t deleted file mode 100644 index ee4eec385e..0000000000 --- a/cpan/Math-BigInt/t/bnstr-mbi.t +++ /dev/null @@ -1,158 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 220; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - { - my $test = qq|\$x = Math::BigInt -> new("$x_str");| - . qq| \$str = \$x -> bnstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); - } - -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -1:1e+0 -10:1e+1 -100:1e+2 -1000:1e+3 -10000:1e+4 -100000:1e+5 -1000000:1e+6 -10000000:1e+7 -100000000:1e+8 -1000000000:1e+9 -10000000000:1e+10 -100000000000:1e+11 -1000000000000:1e+12 - -12:1.2e+1 -120:1.2e+2 -1200:1.2e+3 -12000:1.2e+4 -120000:1.2e+5 -1200000:1.2e+6 -12000000:1.2e+7 -120000000:1.2e+8 -1200000000:1.2e+9 -12000000000:1.2e+10 -120000000000:1.2e+11 -1200000000000:1.2e+12 - -123:1.23e+2 -1230:1.23e+3 -12300:1.23e+4 -123000:1.23e+5 -1230000:1.23e+6 -12300000:1.23e+7 -123000000:1.23e+8 -1230000000:1.23e+9 -12300000000:1.23e+10 -123000000000:1.23e+11 -1230000000000:1.23e+12 - -1234:1.234e+3 -12340:1.234e+4 -123400:1.234e+5 -1234000:1.234e+6 -12340000:1.234e+7 -123400000:1.234e+8 -1234000000:1.234e+9 -12340000000:1.234e+10 -123400000000:1.234e+11 -1234000000000:1.234e+12 - -3:3e+0 -31:3.1e+1 -314:3.14e+2 -3141:3.141e+3 -31415:3.1415e+4 -314159:3.14159e+5 -3141592:3.141592e+6 - -# negative numbers - --1:-1e+0 --10:-1e+1 --100:-1e+2 --1000:-1e+3 --10000:-1e+4 --100000:-1e+5 --1000000:-1e+6 --10000000:-1e+7 --100000000:-1e+8 --1000000000:-1e+9 --10000000000:-1e+10 --100000000000:-1e+11 --1000000000000:-1e+12 - --12:-1.2e+1 --120:-1.2e+2 --1200:-1.2e+3 --12000:-1.2e+4 --120000:-1.2e+5 --1200000:-1.2e+6 --12000000:-1.2e+7 --120000000:-1.2e+8 --1200000000:-1.2e+9 --12000000000:-1.2e+10 --120000000000:-1.2e+11 --1200000000000:-1.2e+12 - --123:-1.23e+2 --1230:-1.23e+3 --12300:-1.23e+4 --123000:-1.23e+5 --1230000:-1.23e+6 --12300000:-1.23e+7 --123000000:-1.23e+8 --1230000000:-1.23e+9 --12300000000:-1.23e+10 --123000000000:-1.23e+11 --1230000000000:-1.23e+12 - --1234:-1.234e+3 --12340:-1.234e+4 --123400:-1.234e+5 --1234000:-1.234e+6 --12340000:-1.234e+7 --123400000:-1.234e+8 --1234000000:-1.234e+9 --12340000000:-1.234e+10 --123400000000:-1.234e+11 --1234000000000:-1.234e+12 - --3:-3e+0 --31:-3.1e+1 --314:-3.14e+2 --3141:-3.141e+3 --31415:-3.1415e+4 --314159:-3.14159e+5 --3141592:-3.141592e+6 diff --git a/cpan/Math-BigInt/t/bpi-mbf.t b/cpan/Math-BigInt/t/bpi-mbf.t deleted file mode 100644 index 38b9350b2d..0000000000 --- a/cpan/Math-BigInt/t/bpi-mbf.t +++ /dev/null @@ -1,53 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 10; - -use Math::BigFloat; -use Scalar::Util qw< refaddr >; - -my $x; - -################################################################################ - -note('class method'); - -# When no accuracy is specified, default accuracy shall be used. - -$x = Math::BigFloat -> bpi(); -is($x, '3.141592653589793238462643383279502884197', - '$x = Math::BigFloat -> bpi();'); -is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat'); - -# When accuracy is specified, it shall be used. - -$x = Math::BigFloat -> bpi(10); -is($x, '3.141592654', - '$x = Math::BigFloat -> bpi(10);'); -is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat'); - -################################################################################ - -note('instance method'); - -my $y; - -# When no accuracy is specified, default accuracy shall be used. - -$x = Math::BigFloat -> new(100); -$y = $x -> bpi(); -is($x, '3.141592653589793238462643383279502884197', - '$x = Math::BigFloat -> new(100); $y = $x -> bpi();'); -is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat'); -is(refaddr($x), refaddr($y), '$x and $y are the same object'); - -# When accuracy is specified, it shall be used. - -$x = Math::BigFloat -> new(100); -$y = $x -> bpi(10); -is($x, '3.141592654', - '$x = Math::BigFloat -> new(100); $y = $x -> bpi(10);'); -is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat'); -is(refaddr($x), refaddr($y), '$x and $y are the same object'); diff --git a/cpan/Math-BigInt/t/bpi-mbi.t b/cpan/Math-BigInt/t/bpi-mbi.t deleted file mode 100644 index 6fa66687de..0000000000 --- a/cpan/Math-BigInt/t/bpi-mbi.t +++ /dev/null @@ -1,103 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 24; - -use Math::BigInt; -use Scalar::Util qw< refaddr >; - -my $x; - -################################################################################ - -note('class method, without upgrading'); - -$x = Math::BigInt -> bpi(); -is($x, '3', '$x = Math::BigInt -> bpi()'); -is(ref($x), 'Math::BigInt', - '$x is a Math::BigInt'); - -$x = Math::BigInt -> bpi(10); -is($x, '3', '$x = Math::BigInt -> bpi(10)'); -is(ref($x), 'Math::BigInt', - '$x is a Math::BigInt'); - -note('class method, with upgrading'); - -require Math::BigFloat; -Math::BigInt -> upgrade('Math::BigFloat'); - -# When no accuracy is specified, default accuracy shall be used. - -$x = Math::BigInt -> bpi(); -is($x, '3.141592653589793238462643383279502884197', '$x = Math::BigInt -> bpi()'); -is(ref($x), "Math::BigFloat", - '$x is a Math::BigFloat'); - -# When accuracy is specified, it shall be used. - -$x = Math::BigInt -> bpi(10); -is($x, '3.141592654', '$x = Math::BigInt -> bpi(10)'); -is(ref($x), "Math::BigFloat", - '$x is a Math::BigFloat'); - -################################################################################ - -Math::BigInt -> upgrade(undef); - -note('instance method, without upgrading'); - -my $y; - -$x = Math::BigInt -> new(100); -$y = $x -> bpi(); -is($x, '3', - '$x = Math::BigInt -> new(100); $y = $x -> bpi();'); -is(ref($x), 'Math::BigInt', - '$x is a Math::BigInt'); -is(refaddr($x), refaddr($y), '$x and $y are the same object'); - -$x = Math::BigInt -> new(100); -$y = $x -> bpi(10); -is($x, '3', - '$x = Math::BigInt -> new(100); $y = $x -> bpi(10);'); -is(ref($x), 'Math::BigInt', - '$x is a Math::BigInt'); -is(refaddr($x), refaddr($y), '$x and $y are the same object'); - -note('instance method, with upgrading'); - -require Math::BigFloat; -Math::BigInt -> upgrade('Math::BigFloat'); - -# When no accuracy is specified, default accuracy shall be used. - -# When upgrading is in effect, a new object is returned. - -$x = Math::BigInt -> new(100); -$y = $x -> bpi(); -is($x, '100', - '$x = Math::BigInt -> new(100); $y = $x -> bpi();'); -is(ref($x), "Math::BigInt", - '$x is a Math::BigInt'); -is($y, '3.141592653589793238462643383279502884197', - '$x = Math::BigInt -> new(100); $y = $x -> bpi();'); -is(ref($y), "Math::BigFloat", - '$y is a Math::BigFloat'); -isnt(refaddr($x), refaddr($y), '$x and $y are not the same object'); - -# When accuracy is specified, it shall be used. - -$x = Math::BigInt -> new(100); -$y = $x -> bpi(10); -is($x, '100', - '$x = Math::BigInt -> new(100); $y = $x -> bpi(10);'); -is(ref($x), "Math::BigInt", - '$x is a Math::BigInt'); -is($y, '3.141592654', - '$x = Math::BigInt -> new(100); $y = $x -> bpi();'); -is(ref($y), "Math::BigFloat", - '$y is a Math::BigFloat'); -isnt(refaddr($x), refaddr($y), '$x and $y are not the same object'); diff --git a/cpan/Math-BigInt/t/bpow-mbf.t b/cpan/Math-BigInt/t/bpow-mbf.t deleted file mode 100644 index 72ad4d9c21..0000000000 --- a/cpan/Math-BigInt/t/bpow-mbf.t +++ /dev/null @@ -1,348 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 255; - -use Math::BigFloat; - -my $class = "Math::BigFloat"; - -use Math::Complex (); - -my $inf = $Math::Complex::Inf; -my $nan = $inf - $inf; - -# The following is used to compute the data at the end of this file. - -if (0) { - my @x = (-$inf, -64, -3, -2.5, -2, -1.5, -1, -0.5, 0, - 0.5, 1, 1.5, 2, 2.5, 3, 64, $inf); - my @y = (-$inf, -3, -2.5, -2, -1.5, -1, -0.5, 0, - 0.5, 1, 1.5, 2, 2.5, 3, $inf); - for my $x (@x) { - for my $y (@y) { - - # The exceptions here are based on Wolfram Alpha, - # https://www.wolframalpha.com/ - - my $z = $x == -$inf && $y == 0 ? $nan - : $x == $inf && $y == 0 ? $nan - : $x == -1 && $y == -$inf ? $nan - : $x == -1 && $y == $inf ? $nan - : $x ** $y; - - # Unfortunately, Math::Big* uses "inf", not "Inf" as Perl. - - printf "%s\n", join ":", map { $_ == $inf ? "inf" - : $_ == -$inf ? "-inf" - : $_ } $x, $y, $z; - } - } - - exit; -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my @args = split /:/; - my $want = pop @args; - - my ($x, $y, $z); - - my $test = qq|\$x = $class -> new("$args[0]"); | - . qq|\$y = $class -> new("$args[1]"); | - . qq|\$z = \$x -> bpow(\$y)|; - - eval "$test"; - die $@ if $@; - - subtest $test => sub { - plan tests => 5; - - is(ref($x), $class, "\$x is still a $class"); - - is(ref($y), $class, "\$y is still a $class"); - is($y, $args[1], "\$y is unmodified"); - - is(ref($z), $class, "\$z is a $class"); - - # If $want is a finite non-integer and $x is finite, measure the - # relative difference. - - if ($want * 0 == 0 && $want != int $want && $x -> is_finite()) { - if (abs(($z -> numify() - $want) / $want) < 1e-8) { - pass("\$z has the right value"); - } else { - fail("\$z has the right value"); - diag(<<"EOF"); - got: '$z' - expected: '$want' -EOF - } - } else { - is($z, $want, "\$z has the right value"); - } - }; -} - -__END__ --inf:-inf:0 --inf:-3:0 --inf:-2.5:0 --inf:-2:0 --inf:-1.5:0 --inf:-1:0 --inf:-0.5:0 --inf:0:NaN --inf:0.5:inf --inf:1:-inf --inf:1.5:inf --inf:2:inf --inf:2.5:inf --inf:3:-inf --inf:inf:inf --64:-inf:0 --64:-3:-3.814697265625e-06 --64:-2.5:NaN --64:-2:0.000244140625 --64:-1.5:NaN --64:-1:-0.015625 --64:-0.5:NaN --64:0:1 --64:0.5:NaN --64:1:-64 --64:1.5:NaN --64:2:4096 --64:2.5:NaN --64:3:-262144 --64:inf:inf --3:-inf:0 --3:-3:-0.037037037037037 --3:-2.5:NaN --3:-2:0.111111111111111 --3:-1.5:NaN --3:-1:-0.333333333333333 --3:-0.5:NaN --3:0:1 --3:0.5:NaN --3:1:-3 --3:1.5:NaN --3:2:9 --3:2.5:NaN --3:3:-27 --3:inf:inf --2.5:-inf:0 --2.5:-3:-0.064 --2.5:-2.5:NaN --2.5:-2:0.16 --2.5:-1.5:NaN --2.5:-1:-0.4 --2.5:-0.5:NaN --2.5:0:1 --2.5:0.5:NaN --2.5:1:-2.5 --2.5:1.5:NaN --2.5:2:6.25 --2.5:2.5:NaN --2.5:3:-15.625 --2.5:inf:inf --2:-inf:0 --2:-3:-0.125 --2:-2.5:NaN --2:-2:0.25 --2:-1.5:NaN --2:-1:-0.5 --2:-0.5:NaN --2:0:1 --2:0.5:NaN --2:1:-2 --2:1.5:NaN --2:2:4 --2:2.5:NaN --2:3:-8 --2:inf:inf --1.5:-inf:0 --1.5:-3:-0.296296296296296 --1.5:-2.5:NaN --1.5:-2:0.444444444444444 --1.5:-1.5:NaN --1.5:-1:-0.666666666666667 --1.5:-0.5:NaN --1.5:0:1 --1.5:0.5:NaN --1.5:1:-1.5 --1.5:1.5:NaN --1.5:2:2.25 --1.5:2.5:NaN --1.5:3:-3.375 --1.5:inf:inf --1:-inf:NaN --1:-3:-1 --1:-2.5:NaN --1:-2:1 --1:-1.5:NaN --1:-1:-1 --1:-0.5:NaN --1:0:1 --1:0.5:NaN --1:1:-1 --1:1.5:NaN --1:2:1 --1:2.5:NaN --1:3:-1 --1:inf:NaN --0.5:-inf:inf --0.5:-3:-8 --0.5:-2.5:NaN --0.5:-2:4 --0.5:-1.5:NaN --0.5:-1:-2 --0.5:-0.5:NaN --0.5:0:1 --0.5:0.5:NaN --0.5:1:-0.5 --0.5:1.5:NaN --0.5:2:0.25 --0.5:2.5:NaN --0.5:3:-0.125 --0.5:inf:0 -0:-inf:inf -0:-3:inf -0:-2.5:inf -0:-2:inf -0:-1.5:inf -0:-1:inf -0:-0.5:inf -0:0:1 -0:0.5:0 -0:1:0 -0:1.5:0 -0:2:0 -0:2.5:0 -0:3:0 -0:inf:0 -0.5:-inf:inf -0.5:-3:8 -0.5:-2.5:5.65685424949238 -0.5:-2:4 -0.5:-1.5:2.82842712474619 -0.5:-1:2 -0.5:-0.5:1.4142135623731 -0.5:0:1 -0.5:0.5:0.707106781186548 -0.5:1:0.5 -0.5:1.5:0.353553390593274 -0.5:2:0.25 -0.5:2.5:0.176776695296637 -0.5:3:0.125 -0.5:inf:0 -1:-inf:1 -1:-3:1 -1:-2.5:1 -1:-2:1 -1:-1.5:1 -1:-1:1 -1:-0.5:1 -1:0:1 -1:0.5:1 -1:1:1 -1:1.5:1 -1:2:1 -1:2.5:1 -1:3:1 -1:inf:1 -1.5:-inf:0 -1.5:-3:0.296296296296296 -1.5:-2.5:0.362887369301212 -1.5:-2:0.444444444444444 -1.5:-1.5:0.544331053951817 -1.5:-1:0.666666666666667 -1.5:-0.5:0.816496580927726 -1.5:0:1 -1.5:0.5:1.22474487139159 -1.5:1:1.5 -1.5:1.5:1.83711730708738 -1.5:2:2.25 -1.5:2.5:2.75567596063108 -1.5:3:3.375 -1.5:inf:inf -2:-inf:0 -2:-3:0.125 -2:-2.5:0.176776695296637 -2:-2:0.25 -2:-1.5:0.353553390593274 -2:-1:0.5 -2:-0.5:0.707106781186548 -2:0:1 -2:0.5:1.4142135623731 -2:1:2 -2:1.5:2.82842712474619 -2:2:4 -2:2.5:5.65685424949238 -2:3:8 -2:inf:inf -2.5:-inf:0 -2.5:-3:0.064 -2.5:-2.5:0.101192885125388 -2.5:-2:0.16 -2.5:-1.5:0.25298221281347 -2.5:-1:0.4 -2.5:-0.5:0.632455532033676 -2.5:0:1 -2.5:0.5:1.58113883008419 -2.5:1:2.5 -2.5:1.5:3.95284707521047 -2.5:2:6.25 -2.5:2.5:9.88211768802619 -2.5:3:15.625 -2.5:inf:inf -3:-inf:0 -3:-3:0.037037037037037 -3:-2.5:0.0641500299099584 -3:-2:0.111111111111111 -3:-1.5:0.192450089729875 -3:-1:0.333333333333333 -3:-0.5:0.577350269189626 -3:0:1 -3:0.5:1.73205080756888 -3:1:3 -3:1.5:5.19615242270663 -3:2:9 -3:2.5:15.5884572681199 -3:3:27 -3:inf:inf -64:-inf:0 -64:-3:3.814697265625e-06 -64:-2.5:3.0517578125e-05 -64:-2:0.000244140625 -64:-1.5:0.001953125 -64:-1:0.015625 -64:-0.5:0.125 -64:0:1 -64:0.5:8 -64:1:64 -64:1.5:512 -64:2:4096 -64:2.5:32768 -64:3:262144 -64:inf:inf -inf:-inf:0 -inf:-3:0 -inf:-2.5:0 -inf:-2:0 -inf:-1.5:0 -inf:-1:0 -inf:-0.5:0 -inf:0:NaN -inf:0.5:inf -inf:1:inf -inf:1.5:inf -inf:2:inf -inf:2.5:inf -inf:3:inf -inf:inf:inf diff --git a/cpan/Math-BigInt/t/bpow-mbi.t b/cpan/Math-BigInt/t/bpow-mbi.t deleted file mode 100644 index 6fbf270821..0000000000 --- a/cpan/Math-BigInt/t/bpow-mbi.t +++ /dev/null @@ -1,172 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 99; - -use Math::BigInt; - -my $class = "Math::BigInt"; - -use Math::Complex (); - -my $inf = $Math::Complex::Inf; -my $nan = $inf - $inf; - -# The following is used to compute the data at the end of this file. - -if (0) { - for my $x (-$inf, -64, -3, -2, -1, 0, 1, 2, 3, 64, $inf) { - for my $y (-$inf, -3, -2, -1, 0, 1, 2, 3, $inf) { - - # The exceptions here are based on Wolfram Alpha, - # https://www.wolframalpha.com/ - - my $z = $x == -$inf && $y == 0 ? $nan - : $x == $inf && $y == 0 ? $nan - : $x == -1 && $y == -$inf ? $nan - : $x == -1 && $y == $inf ? $nan - : int($x ** $y); - - # Unfortunately, Math::Big* uses "inf", not "Inf" as Perl. - - printf "%s\n", join ":", map { $_ == $inf ? "inf" - : $_ == -$inf ? "-inf" - : $_ } $x, $y, $z; - } - } - - exit; -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my @args = split /:/; - my $want = pop @args; - - my ($x, $y, $z); - - my $test = qq|\$x = $class -> new("$args[0]"); | - . qq|\$y = $class -> new("$args[1]"); | - . qq|\$z = \$x -> bpow(\$y)|; - - eval "$test"; - die $@ if $@; - - subtest $test => sub { - plan tests => 5; - - is(ref($x), $class, "\$x is still a $class"); - - is(ref($y), $class, "\$y is still a $class"); - is($y, $args[1], "\$y is unmodified"); - - is(ref($z), $class, "\$z is a $class"); - is($z, $want, "\$z has the right value"); - }; -} - -__DATA__ --inf:-inf:0 --inf:-3:0 --inf:-2:0 --inf:-1:0 --inf:0:NaN --inf:1:-inf --inf:2:inf --inf:3:-inf --inf:inf:inf --64:-inf:0 --64:-3:0 --64:-2:0 --64:-1:0 --64:0:1 --64:1:-64 --64:2:4096 --64:3:-262144 --64:inf:inf --3:-inf:0 --3:-3:0 --3:-2:0 --3:-1:0 --3:0:1 --3:1:-3 --3:2:9 --3:3:-27 --3:inf:inf --2:-inf:0 --2:-3:0 --2:-2:0 --2:-1:0 --2:0:1 --2:1:-2 --2:2:4 --2:3:-8 --2:inf:inf --1:-inf:NaN --1:-3:-1 --1:-2:1 --1:-1:-1 --1:0:1 --1:1:-1 --1:2:1 --1:3:-1 --1:inf:NaN -0:-inf:inf -0:-3:inf -0:-2:inf -0:-1:inf -0:0:1 -0:1:0 -0:2:0 -0:3:0 -0:inf:0 -1:-inf:1 -1:-3:1 -1:-2:1 -1:-1:1 -1:0:1 -1:1:1 -1:2:1 -1:3:1 -1:inf:1 -2:-inf:0 -2:-3:0 -2:-2:0 -2:-1:0 -2:0:1 -2:1:2 -2:2:4 -2:3:8 -2:inf:inf -3:-inf:0 -3:-3:0 -3:-2:0 -3:-1:0 -3:0:1 -3:1:3 -3:2:9 -3:3:27 -3:inf:inf -64:-inf:0 -64:-3:0 -64:-2:0 -64:-1:0 -64:0:1 -64:1:64 -64:2:4096 -64:3:262144 -64:inf:inf -inf:-inf:0 -inf:-3:0 -inf:-2:0 -inf:-1:0 -inf:0:NaN -inf:1:inf -inf:2:inf -inf:3:inf -inf:inf:inf diff --git a/cpan/Math-BigInt/t/bsstr-mbf.t b/cpan/Math-BigInt/t/bsstr-mbf.t deleted file mode 100644 index 3c18e6c64f..0000000000 --- a/cpan/Math-BigInt/t/bsstr-mbf.t +++ /dev/null @@ -1,275 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 460; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - my $test = qq|\$x = Math::BigFloat -> new("$x_str");| - . qq| \$str = \$x -> bsstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -0.000000000001:1e-12 -0.00000000001:1e-11 -0.0000000001:1e-10 -0.000000001:1e-9 -0.00000001:1e-8 -0.0000001:1e-7 -0.000001:1e-6 -0.00001:1e-5 -0.0001:1e-4 -0.001:1e-3 -0.01:1e-2 -0.1:1e-1 -1:1e+0 -10:1e+1 -100:1e+2 -1000:1e+3 -10000:1e+4 -100000:1e+5 -1000000:1e+6 -10000000:1e+7 -100000000:1e+8 -1000000000:1e+9 -10000000000:1e+10 -100000000000:1e+11 -1000000000000:1e+12 - -0.0000000000012:12e-13 -0.000000000012:12e-12 -0.00000000012:12e-11 -0.0000000012:12e-10 -0.000000012:12e-9 -0.00000012:12e-8 -0.0000012:12e-7 -0.000012:12e-6 -0.00012:12e-5 -0.0012:12e-4 -0.012:12e-3 -0.12:12e-2 -1.2:12e-1 -12:12e+0 -120:12e+1 -1200:12e+2 -12000:12e+3 -120000:12e+4 -1200000:12e+5 -12000000:12e+6 -120000000:12e+7 -1200000000:12e+8 -12000000000:12e+9 -120000000000:12e+10 -1200000000000:12e+11 - -0.00000000000123:123e-14 -0.0000000000123:123e-13 -0.000000000123:123e-12 -0.00000000123:123e-11 -0.0000000123:123e-10 -0.000000123:123e-9 -0.00000123:123e-8 -0.0000123:123e-7 -0.000123:123e-6 -0.00123:123e-5 -0.0123:123e-4 -0.123:123e-3 -1.23:123e-2 -12.3:123e-1 -123:123e+0 -1230:123e+1 -12300:123e+2 -123000:123e+3 -1230000:123e+4 -12300000:123e+5 -123000000:123e+6 -1230000000:123e+7 -12300000000:123e+8 -123000000000:123e+9 -1230000000000:123e+10 - -0.000000000001234:1234e-15 -0.00000000001234:1234e-14 -0.0000000001234:1234e-13 -0.000000001234:1234e-12 -0.00000001234:1234e-11 -0.0000001234:1234e-10 -0.000001234:1234e-9 -0.00001234:1234e-8 -0.0001234:1234e-7 -0.001234:1234e-6 -0.01234:1234e-5 -0.1234:1234e-4 -1.234:1234e-3 -12.34:1234e-2 -123.4:1234e-1 -1234:1234e+0 -12340:1234e+1 -123400:1234e+2 -1234000:1234e+3 -12340000:1234e+4 -123400000:1234e+5 -1234000000:1234e+6 -12340000000:1234e+7 -123400000000:1234e+8 -1234000000000:1234e+9 - -0.000003141592:3141592e-12 -0.00003141592:3141592e-11 -0.0003141592:3141592e-10 -0.003141592:3141592e-9 -0.03141592:3141592e-8 -0.3141592:3141592e-7 -3.141592:3141592e-6 -31.41592:3141592e-5 -314.1592:3141592e-4 -3141.592:3141592e-3 -31415.92:3141592e-2 -314159.2:3141592e-1 -3141592:3141592e+0 - -# negative numbers - --0.000000000001:-1e-12 --0.00000000001:-1e-11 --0.0000000001:-1e-10 --0.000000001:-1e-9 --0.00000001:-1e-8 --0.0000001:-1e-7 --0.000001:-1e-6 --0.00001:-1e-5 --0.0001:-1e-4 --0.001:-1e-3 --0.01:-1e-2 --0.1:-1e-1 --1:-1e+0 --10:-1e+1 --100:-1e+2 --1000:-1e+3 --10000:-1e+4 --100000:-1e+5 --1000000:-1e+6 --10000000:-1e+7 --100000000:-1e+8 --1000000000:-1e+9 --10000000000:-1e+10 --100000000000:-1e+11 --1000000000000:-1e+12 - --0.0000000000012:-12e-13 --0.000000000012:-12e-12 --0.00000000012:-12e-11 --0.0000000012:-12e-10 --0.000000012:-12e-9 --0.00000012:-12e-8 --0.0000012:-12e-7 --0.000012:-12e-6 --0.00012:-12e-5 --0.0012:-12e-4 --0.012:-12e-3 --0.12:-12e-2 --1.2:-12e-1 --12:-12e+0 --120:-12e+1 --1200:-12e+2 --12000:-12e+3 --120000:-12e+4 --1200000:-12e+5 --12000000:-12e+6 --120000000:-12e+7 --1200000000:-12e+8 --12000000000:-12e+9 --120000000000:-12e+10 --1200000000000:-12e+11 - --0.00000000000123:-123e-14 --0.0000000000123:-123e-13 --0.000000000123:-123e-12 --0.00000000123:-123e-11 --0.0000000123:-123e-10 --0.000000123:-123e-9 --0.00000123:-123e-8 --0.0000123:-123e-7 --0.000123:-123e-6 --0.00123:-123e-5 --0.0123:-123e-4 --0.123:-123e-3 --1.23:-123e-2 --12.3:-123e-1 --123:-123e+0 --1230:-123e+1 --12300:-123e+2 --123000:-123e+3 --1230000:-123e+4 --12300000:-123e+5 --123000000:-123e+6 --1230000000:-123e+7 --12300000000:-123e+8 --123000000000:-123e+9 --1230000000000:-123e+10 - --0.000000000001234:-1234e-15 --0.00000000001234:-1234e-14 --0.0000000001234:-1234e-13 --0.000000001234:-1234e-12 --0.00000001234:-1234e-11 --0.0000001234:-1234e-10 --0.000001234:-1234e-9 --0.00001234:-1234e-8 --0.0001234:-1234e-7 --0.001234:-1234e-6 --0.01234:-1234e-5 --0.1234:-1234e-4 --1.234:-1234e-3 --12.34:-1234e-2 --123.4:-1234e-1 --1234:-1234e+0 --12340:-1234e+1 --123400:-1234e+2 --1234000:-1234e+3 --12340000:-1234e+4 --123400000:-1234e+5 --1234000000:-1234e+6 --12340000000:-1234e+7 --123400000000:-1234e+8 --1234000000000:-1234e+9 - --0.000003141592:-3141592e-12 --0.00003141592:-3141592e-11 --0.0003141592:-3141592e-10 --0.003141592:-3141592e-9 --0.03141592:-3141592e-8 --0.3141592:-3141592e-7 --3.141592:-3141592e-6 --31.41592:-3141592e-5 --314.1592:-3141592e-4 --3141.592:-3141592e-3 --31415.92:-3141592e-2 --314159.2:-3141592e-1 --3141592:-3141592e+0 diff --git a/cpan/Math-BigInt/t/bsstr-mbi.t b/cpan/Math-BigInt/t/bsstr-mbi.t deleted file mode 100644 index 1093aa2821..0000000000 --- a/cpan/Math-BigInt/t/bsstr-mbi.t +++ /dev/null @@ -1,158 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 220; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $expected) = split /:/; - my ($x, $str); - - { - my $test = qq|\$x = Math::BigInt -> new("$x_str");| - . qq| \$str = \$x -> bsstr();|; - - note "\n$test\n\n"; - eval $test; - - is($str, $expected, qq|input value is "$x_str"|); - is($x, $x_str, "input object is unmodified"); - } - -} - -__DATA__ - -NaN:NaN - -inf:inf --inf:-inf - -0:0e+0 - -# positive numbers - -1:1e+0 -10:1e+1 -100:1e+2 -1000:1e+3 -10000:1e+4 -100000:1e+5 -1000000:1e+6 -10000000:1e+7 -100000000:1e+8 -1000000000:1e+9 -10000000000:1e+10 -100000000000:1e+11 -1000000000000:1e+12 - -12:12e+0 -120:12e+1 -1200:12e+2 -12000:12e+3 -120000:12e+4 -1200000:12e+5 -12000000:12e+6 -120000000:12e+7 -1200000000:12e+8 -12000000000:12e+9 -120000000000:12e+10 -1200000000000:12e+11 - -123:123e+0 -1230:123e+1 -12300:123e+2 -123000:123e+3 -1230000:123e+4 -12300000:123e+5 -123000000:123e+6 -1230000000:123e+7 -12300000000:123e+8 -123000000000:123e+9 -1230000000000:123e+10 - -1234:1234e+0 -12340:1234e+1 -123400:1234e+2 -1234000:1234e+3 -12340000:1234e+4 -123400000:1234e+5 -1234000000:1234e+6 -12340000000:1234e+7 -123400000000:1234e+8 -1234000000000:1234e+9 - -3:3e+0 -31:31e+0 -314:314e+0 -3141:3141e+0 -31415:31415e+0 -314159:314159e+0 -3141592:3141592e+0 - -# negative numbers - --1:-1e+0 --10:-1e+1 --100:-1e+2 --1000:-1e+3 --10000:-1e+4 --100000:-1e+5 --1000000:-1e+6 --10000000:-1e+7 --100000000:-1e+8 --1000000000:-1e+9 --10000000000:-1e+10 --100000000000:-1e+11 --1000000000000:-1e+12 - --12:-12e+0 --120:-12e+1 --1200:-12e+2 --12000:-12e+3 --120000:-12e+4 --1200000:-12e+5 --12000000:-12e+6 --120000000:-12e+7 --1200000000:-12e+8 --12000000000:-12e+9 --120000000000:-12e+10 --1200000000000:-12e+11 - --123:-123e+0 --1230:-123e+1 --12300:-123e+2 --123000:-123e+3 --1230000:-123e+4 --12300000:-123e+5 --123000000:-123e+6 --1230000000:-123e+7 --12300000000:-123e+8 --123000000000:-123e+9 --1230000000000:-123e+10 - --1234:-1234e+0 --12340:-1234e+1 --123400:-1234e+2 --1234000:-1234e+3 --12340000:-1234e+4 --123400000:-1234e+5 --1234000000:-1234e+6 --12340000000:-1234e+7 --123400000000:-1234e+8 --1234000000000:-1234e+9 - --3:-3e+0 --31:-31e+0 --314:-314e+0 --3141:-3141e+0 --31415:-31415e+0 --314159:-314159e+0 --3141592:-3141592e+0 diff --git a/cpan/Math-BigInt/t/buparrow-mbi.t b/cpan/Math-BigInt/t/buparrow-mbi.t deleted file mode 100644 index f2583418f9..0000000000 --- a/cpan/Math-BigInt/t/buparrow-mbi.t +++ /dev/null @@ -1,581 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1021; - -my $class; - -BEGIN { - $class = 'Math::BigInt'; - use_ok($class); -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($a, $n, $b, $expected) = split /:/; - - # buparrow() modifies the invocand. - - { - my ($x, $y); - my $test = qq|\$x = $class->new("$a"); \$y = \$x->buparrow($n, $b);|; - - subtest $test, - sub { - plan tests => 4; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - is(ref($y), $class, - "'$test' output arg is a $class"); - - is($y -> bstr(), $expected, - "'$test' output arg has the right value"); - - is($x -> bstr(), $expected, - "'$test' invocand has the right value"); - }; - } - - # uparrow() does not modify the invocand. - - { - my ($x, $y); - my $test = qq|\$x = $class->new("$a"); \$y = \$x->uparrow($n, $b);|; - - subtest $test, - sub { - plan tests => 4; - - eval $test; - is($@, "", "'$test' gives emtpy \$\@"); - - is(ref($y), $class, - "'$test' output arg is a $class"); - - is($y -> bstr(), $expected, - "'$test' output arg has the right value"); - - is($x -> bstr(), $a, - "'$test' invocand has the right value"); - }; - } -} - -__DATA__ -0:0:0:0 -0:0:1:0 -0:0:2:0 -0:0:3:0 -0:0:4:0 -0:0:5:0 -0:0:6:0 -0:0:7:0 -0:0:8:0 -0:0:9:0 -0:1:0:1 -0:1:1:0 -0:1:2:0 -0:1:3:0 -0:1:4:0 -0:1:5:0 -0:1:6:0 -0:1:7:0 -0:1:8:0 -0:1:9:0 -0:2:0:1 -0:2:1:0 -0:2:2:1 -0:2:3:0 -0:2:4:1 -0:2:5:0 -0:2:6:1 -0:2:7:0 -0:2:8:1 -0:2:9:0 -0:3:0:1 -0:3:1:0 -0:3:2:1 -0:3:3:0 -0:3:4:1 -0:3:5:0 -0:3:6:1 -0:3:7:0 -0:3:8:1 -0:3:9:0 -0:4:0:1 -0:4:1:0 -0:4:2:1 -0:4:3:0 -0:4:4:1 -0:4:5:0 -0:4:6:1 -0:4:7:0 -0:4:8:1 -0:4:9:0 -0:5:0:1 -0:5:1:0 -0:5:2:1 -0:5:3:0 -0:5:4:1 -0:5:5:0 -0:5:6:1 -0:5:7:0 -0:5:8:1 -0:5:9:0 -0:6:0:1 -0:6:1:0 -0:6:2:1 -0:6:3:0 -0:6:4:1 -0:6:5:0 -0:6:6:1 -0:6:7:0 -0:6:8:1 -0:6:9:0 -0:7:0:1 -0:7:1:0 -0:7:2:1 -0:7:3:0 -0:7:4:1 -0:7:5:0 -0:7:6:1 -0:7:7:0 -0:7:8:1 -0:7:9:0 -0:8:0:1 -0:8:1:0 -0:8:2:1 -0:8:3:0 -0:8:4:1 -0:8:5:0 -0:8:6:1 -0:8:7:0 -0:8:8:1 -0:8:9:0 -0:9:0:1 -0:9:1:0 -0:9:2:1 -0:9:3:0 -0:9:4:1 -0:9:5:0 -0:9:6:1 -0:9:7:0 -0:9:8:1 -0:9:9:0 -1:0:0:0 -1:0:1:1 -1:0:2:2 -1:0:3:3 -1:0:4:4 -1:0:5:5 -1:0:6:6 -1:0:7:7 -1:0:8:8 -1:0:9:9 -1:1:0:1 -1:1:1:1 -1:1:2:1 -1:1:3:1 -1:1:4:1 -1:1:5:1 -1:1:6:1 -1:1:7:1 -1:1:8:1 -1:1:9:1 -1:2:0:1 -1:2:1:1 -1:2:2:1 -1:2:3:1 -1:2:4:1 -1:2:5:1 -1:2:6:1 -1:2:7:1 -1:2:8:1 -1:2:9:1 -1:3:0:1 -1:3:1:1 -1:3:2:1 -1:3:3:1 -1:3:4:1 -1:3:5:1 -1:3:6:1 -1:3:7:1 -1:3:8:1 -1:3:9:1 -1:4:0:1 -1:4:1:1 -1:4:2:1 -1:4:3:1 -1:4:4:1 -1:4:5:1 -1:4:6:1 -1:4:7:1 -1:4:8:1 -1:4:9:1 -1:5:0:1 -1:5:1:1 -1:5:2:1 -1:5:3:1 -1:5:4:1 -1:5:5:1 -1:5:6:1 -1:5:7:1 -1:5:8:1 -1:5:9:1 -1:6:0:1 -1:6:1:1 -1:6:2:1 -1:6:3:1 -1:6:4:1 -1:6:5:1 -1:6:6:1 -1:6:7:1 -1:6:8:1 -1:6:9:1 -1:7:0:1 -1:7:1:1 -1:7:2:1 -1:7:3:1 -1:7:4:1 -1:7:5:1 -1:7:6:1 -1:7:7:1 -1:7:8:1 -1:7:9:1 -1:8:0:1 -1:8:1:1 -1:8:2:1 -1:8:3:1 -1:8:4:1 -1:8:5:1 -1:8:6:1 -1:8:7:1 -1:8:8:1 -1:8:9:1 -1:9:0:1 -1:9:1:1 -1:9:2:1 -1:9:3:1 -1:9:4:1 -1:9:5:1 -1:9:6:1 -1:9:7:1 -1:9:8:1 -1:9:9:1 -2:0:0:0 -2:0:1:2 -2:0:2:4 -2:0:3:6 -2:0:4:8 -2:0:5:10 -2:0:6:12 -2:0:7:14 -2:0:8:16 -2:0:9:18 -2:1:0:1 -2:1:1:2 -2:1:2:4 -2:1:3:8 -2:1:4:16 -2:1:5:32 -2:1:6:64 -2:1:7:128 -2:1:8:256 -2:1:9:512 -2:2:0:1 -2:2:1:2 -2:2:2:4 -2:2:3:16 -2:2:4:65536 -2:3:0:1 -2:3:1:2 -2:3:2:4 -2:3:3:65536 -2:4:0:1 -2:4:1:2 -2:4:2:4 -2:5:0:1 -2:5:1:2 -2:5:2:4 -2:6:0:1 -2:6:1:2 -2:6:2:4 -2:7:0:1 -2:7:1:2 -2:7:2:4 -2:8:0:1 -2:8:1:2 -2:8:2:4 -2:9:0:1 -2:9:1:2 -2:9:2:4 -3:0:0:0 -3:0:1:3 -3:0:2:6 -3:0:3:9 -3:0:4:12 -3:0:5:15 -3:0:6:18 -3:0:7:21 -3:0:8:24 -3:0:9:27 -3:1:0:1 -3:1:1:3 -3:1:2:9 -3:1:3:27 -3:1:4:81 -3:1:5:243 -3:1:6:729 -3:1:7:2187 -3:1:8:6561 -3:1:9:19683 -3:2:0:1 -3:2:1:3 -3:2:2:27 -3:2:3:7625597484987 -3:3:0:1 -3:3:1:3 -3:3:2:7625597484987 -3:4:0:1 -3:4:1:3 -3:5:0:1 -3:5:1:3 -3:6:0:1 -3:6:1:3 -3:7:0:1 -3:7:1:3 -3:8:0:1 -3:8:1:3 -3:9:0:1 -3:9:1:3 -4:0:0:0 -4:0:1:4 -4:0:2:8 -4:0:3:12 -4:0:4:16 -4:0:5:20 -4:0:6:24 -4:0:7:28 -4:0:8:32 -4:0:9:36 -4:1:0:1 -4:1:1:4 -4:1:2:16 -4:1:3:64 -4:1:4:256 -4:1:5:1024 -4:1:6:4096 -4:1:7:16384 -4:1:8:65536 -4:1:9:262144 -4:2:0:1 -4:2:1:4 -4:2:2:256 -4:2:3:13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096 -4:3:0:1 -4:3:1:4 -4:4:0:1 -4:4:1:4 -4:5:0:1 -4:5:1:4 -4:6:0:1 -4:6:1:4 -4:7:0:1 -4:7:1:4 -4:8:0:1 -4:8:1:4 -4:9:0:1 -4:9:1:4 -5:0:0:0 -5:0:1:5 -5:0:2:10 -5:0:3:15 -5:0:4:20 -5:0:5:25 -5:0:6:30 -5:0:7:35 -5:0:8:40 -5:0:9:45 -5:1:0:1 -5:1:1:5 -5:1:2:25 -5:1:3:125 -5:1:4:625 -5:1:5:3125 -5:1:6:15625 -5:1:7:78125 -5:1:8:390625 -5:1:9:1953125 -5:2:0:1 -5:2:1:5 -5:2:2:3125 -5:2:3:1911012597945477520356404559703964599198081048990094337139512789246520530242615803012059386519739850265586440155794462235359212788673806972288410146915986602087961896757195701839281660338047611225975533626101001482651123413147768252411493094447176965282756285196737514395357542479093219206641883011787169122552421070050709064674382870851449950256586194461543183511379849133691779928127433840431549236855526783596374102105331546031353725325748636909159778690328266459182983815230286936572873691422648131291743762136325730321645282979486862576245362218017673224940567642819360078720713837072355305446356153946401185348493792719514594505508232749221605848912910945189959948686199543147666938013037176163592594479746164220050885079469804487133205133160739134230540198872570038329801246050197013467397175909027389493923817315786996845899794781068042822436093783946335265422815704302832442385515082316490967285712171708123232790481817268327510112746782317410985888683708522000711733492253913322300756147180429007527677793352306200618286012455254243061006894805446584704820650982664319360960388736258510747074340636286976576702699258649953557976318173902550891331223294743930343956161328334072831663498258145226862004307799084688103804187368324800903873596212919633602583120781673673742533322879296907205490595621406888825991244581842379597863476484315673760923625090371511798941424262270220066286486867868710182980872802560693101949280830825044198424796792058908817112327192301455582916746795197430548026404646854002733993860798594465961501752586965811447568510041568687730903712482535343839285397598749458497050038225012489284001826590056251286187629938044407340142347062055785305325034918189589707199305662188512963187501743535960282201038211616048545121039313312256332260766436236688296850208839496142830484739113991669622649948563685234712873294796680884509405893951104650944137909502276545653133018670633521323028460519434381399810561400652595300731790772711065783494174642684720956134647327748584238274899668755052504394218232191357223054066715373374248543645663782045701654593218154053548393614250664498585403307466468541890148134347714650315037954175778622811776585876941680908203125 -5:3:0:1 -5:3:1:5 -5:4:0:1 -5:4:1:5 -5:5:0:1 -5:5:1:5 -5:6:0:1 -5:6:1:5 -5:7:0:1 -5:7:1:5 -5:8:0:1 -5:8:1:5 -5:9:0:1 -5:9:1:5 -6:0:0:0 -6:0:1:6 -6:0:2:12 -6:0:3:18 -6:0:4:24 -6:0:5:30 -6:0:6:36 -6:0:7:42 -6:0:8:48 -6:0:9:54 -6:1:0:1 -6:1:1:6 -6:1:2:36 -6:1:3:216 -6:1:4:1296 -6:1:5:7776 -6:1:6:46656 -6:1:7:279936 -6:1:8:1679616 -6:1:9:10077696 -6:2:0:1 -6:2:1:6 -6:2:2:46656 -6:3:0:1 -6:3:1:6 -6:4:0:1 -6:4:1:6 -6:5:0:1 -6:5:1:6 -6:6:0:1 -6:6:1:6 -6:7:0:1 -6:7:1:6 -6:8:0:1 -6:8:1:6 -6:9:0:1 -6:9:1:6 -7:0:0:0 -7:0:1:7 -7:0:2:14 -7:0:3:21 -7:0:4:28 -7:0:5:35 -7:0:6:42 -7:0:7:49 -7:0:8:56 -7:0:9:63 -7:1:0:1 -7:1:1:7 -7:1:2:49 -7:1:3:343 -7:1:4:2401 -7:1:5:16807 -7:1:6:117649 -7:1:7:823543 -7:1:8:5764801 -7:1:9:40353607 -7:2:0:1 -7:2:1:7 -7:2:2:823543 -7:3:0:1 -7:3:1:7 -7:4:0:1 -7:4:1:7 -7:5:0:1 -7:5:1:7 -7:6:0:1 -7:6:1:7 -7:7:0:1 -7:7:1:7 -7:8:0:1 -7:8:1:7 -7:9:0:1 -7:9:1:7 -8:0:0:0 -8:0:1:8 -8:0:2:16 -8:0:3:24 -8:0:4:32 -8:0:5:40 -8:0:6:48 -8:0:7:56 -8:0:8:64 -8:0:9:72 -8:1:0:1 -8:1:1:8 -8:1:2:64 -8:1:3:512 -8:1:4:4096 -8:1:5:32768 -8:1:6:262144 -8:1:7:2097152 -8:1:8:16777216 -8:1:9:134217728 -8:2:0:1 -8:2:1:8 -8:2:2:16777216 -8:3:0:1 -8:3:1:8 -8:4:0:1 -8:4:1:8 -8:5:0:1 -8:5:1:8 -8:6:0:1 -8:6:1:8 -8:7:0:1 -8:7:1:8 -8:8:0:1 -8:8:1:8 -8:9:0:1 -8:9:1:8 -9:0:0:0 -9:0:1:9 -9:0:2:18 -9:0:3:27 -9:0:4:36 -9:0:5:45 -9:0:6:54 -9:0:7:63 -9:0:8:72 -9:0:9:81 -9:1:0:1 -9:1:1:9 -9:1:2:81 -9:1:3:729 -9:1:4:6561 -9:1:5:59049 -9:1:6:531441 -9:1:7:4782969 -9:1:8:43046721 -9:1:9:387420489 -9:2:0:1 -9:2:1:9 -9:2:2:387420489 -9:3:0:1 -9:3:1:9 -9:4:0:1 -9:4:1:9 -9:5:0:1 -9:5:1:9 -9:6:0:1 -9:6:1:9 -9:7:0:1 -9:7:1:9 -9:8:0:1 -9:8:1:9 -9:9:0:1 -9:9:1:9 diff --git a/cpan/Math-BigInt/t/const-mbf.t b/cpan/Math-BigInt/t/const-mbf.t deleted file mode 100644 index d6231ae2ff..0000000000 --- a/cpan/Math-BigInt/t/const-mbf.t +++ /dev/null @@ -1,314 +0,0 @@ -# -*- mode: perl; -*- - -# Binary, octal, and hexadecimal floating point literals were introduced in -# v5.22.0. -# -# - It wasn't until v5.28.0 that binary, octal, and hexadecimal floating point -# literals were converted to the correct value on perls compiled with quadmath -# support. -# -# - It wasn't until v5.32.0 that binary and octal floating point literals worked -# correctly with constant overloading. Before v5.32.0, it seems like the -# second character is always silently converted to an "x", so, e.g., "0b1.1p8" -# is passed to the overload::constant subroutine as "0x1.1p8", and "01.1p+8" -# is passed as "0x.1p+8". -# -# - Octal floating point literals using the "0o" prefix were introduced in -# v5.34.0. - -# Note that all numeric literals that should not be overloaded must be quoted. - -use strict; -use warnings; - -use Test::More tests => "170"; - -use Math::BigFloat ":constant"; - -my $class = "Math::BigFloat"; -my $x; - -################################################################################ -# The following tests should be identical for Math::BigInt, Math::BigFloat and -# Math::BigRat. - -# These are handled by "binary". - -$x = 0xff; -is($x, "255", "hexadecimal integer literal 0xff"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Hexadecimal literals using the "0X" prefix require v5.14.0. - skip "perl v5.14.0 required for hexadecimal integer literals" - . " with '0X' prefix", "2" if $] < "5.014"; - - $x = eval "0XFF"; - is($x, "255", "hexadecimal integer literal 0XFF"); - is(ref($x), $class, "value is a $class"); -} - -$x = 0377; -is($x, "255", "octal integer literal 0377"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Octal literals using the "0o" prefix require v5.34.0. - skip "perl v5.34.0 required for octal floating point literals" - . " with '0o' prefix", "4" if $] < "5.034"; - - for my $str (qw/ 0o377 0O377 /) { - $x = eval $str; - is($x, "255", "octal integer literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -$x = 0b11111111; -is($x, "255", "binary integer literal 0b11111111"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Binary literals using the "0B" prefix require v5.14.0. - skip "perl v5.14.0 required for binary integer literals" - . " with '0B' prefix", "2" if $] < "5.014"; - - $x = eval "0B11111111"; - is($x, "255", "binary integer literal 0B11111111"); - is(ref($x), $class, "value is a $class"); -} - -# These are handled by "float". - -$x = 999999999999999999999999999999999999999999999999999999999999999999999999; -is($x, - "999999999999999999999999999999999999999999999999999999999999999999999999", - "decimal integer literal " . ("9" x 72)); -is(ref($x), $class, "value is a $class"); - -$x = 1e72 - 1; -is($x, - "999999999999999999999999999999999999999999999999999999999999999999999999", - "literal 1e72 - 1"); -is(ref($x), $class, "value is a $class"); - -# These are handled by "float". - -SKIP: { - # Hexadecimal floating point literals require v5.28.0. - skip "perl v5.28.0 required for hexadecimal floating point literals", - "6" * "2" + "2" * "2" if $] < "5.028"; - - for my $str (qw/ 0x1.3ap+8 0X1.3AP+8 - 0x1.3ap8 0X1.3AP8 - 0x13a0p-4 0X13A0P-4 /) - { - $x = eval $str; - is($x, "314", "hexadecimal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0x0.0p+8 0X0.0P+8 /) - { - $x = eval $str; - is($x, "0", "hexadecimal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0o" prefix require v5.34.0. - skip "perl v5.34.0 required for octal floating point literals" - . " with '0o' prefix", "6" * "2" + "6" * "2" if $] < "5.034"; - - for my $str (qw/ 0o1.164p+8 0O1.164P+8 - 0o1.164p8 0O1.164P8 - 0o11640p-4 0O11640P-4 /) - { - $x = eval $str; - is($x, "314", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0o0.0p+8 0O0.0P+8 - 0o0.0p8 0O0.0P8 - 0o0.0p-8 0O0.0P-8 /) - { - $x = eval $str; - is($x, "0", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0" prefix require v5.32.0. - skip "perl v5.32.0 required for octal floating point literals", - "6" * "2" + "6" * "2" if $] < "5.032"; - - for my $str (qw/ 01.164p+8 01.164P+8 - 01.164p8 01.164P8 - 011640p-4 011640P-4 /) - { - $x = eval $str; - is($x, "314", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 00.0p+8 00.0P+8 - 00.0p8 00.0P8 - 00.0p-8 00.0P-8 /) - { - $x = eval $str; - is($x, "0", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Binary floating point literals require v5.32.0. - skip "perl v5.32.0 required for binary floating point literals", - "6" * "2" + "6" * "2" if $] < "5.032"; - - for my $str (qw/ 0b1.0011101p+8 0B1.0011101P+8 - 0b1.0011101p8 0B1.0011101P8 - 0b10011101000p-2 0B10011101000P-2 /) - { - $x = eval $str; - is($x, "314", "binary floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0b0p+8 0B0P+8 - 0b0p8 0B0P8 - 0b0p-8 0B0P-8 - /) - { - $x = eval $str; - is($x, "0", "binary floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -# These are handled by "integer". - -$x = 314; -is($x, "314", "integer literal 314"); -is(ref($x), $class, "value is a $class"); - -$x = 0; -is($x, "0", "integer literal 0"); -is(ref($x), $class, "value is a $class"); - -$x = 2 ** 255; -is($x, - "578960446186580977117854925043439539266" - . "34992332820282019728792003956564819968", - "2 ** 255"); -is(ref($x), $class, "value is a $class"); - -# These are handled by "binary". - -{ - no warnings "portable"; # protect against "non-portable" warnings - - # hexadecimal constant - $x = 0x123456789012345678901234567890; - is($x, - "94522879687365475552814062743484560", - "hexadecimal constant 0x123456789012345678901234567890"); - is(ref($x), $class, "value is a $class"); - - # octal constant - $x = 012345676543210123456765432101234567654321; - is($x, - "1736132869400711976876385488263403729", - "octal constant 012345676543210123456765432101234567654321"); - is(ref($x), $class, "value is a $class"); - - # binary constant - $x = 0b01010100011001010110110001110011010010010110000101101101; - is($x, - "23755414508757357", - "binary constant 0b0101010001100101011011000111" - . "0011010010010110000101101101"); - is(ref($x), $class, "value is a $class"); -} - -################################################################################ -# The following tests are unique to $class. - -# These are handled by "float". - -$x = 0.999999999999999999999999999999999999999999999999999999999999999999999999; -is($x, - "0.999999999999999999999999999999999999999999999999999999999999999999999999", - "decimal floating point literal 0." . ("9" x 72)); -is(ref($x), $class, "value is a $class"); - -$x = 1e72 - 0.1; -is($x, - "999999999999999999999999999999999999999999999999999999999999999999999999.9", - "literal 1e72 - 0.1"); -is(ref($x), $class, "value is a $class"); - -# These are handled by "float". - -SKIP: { - # Hexadecimal floating point literals require v5.28.0. - skip "perl v5.28.0 required for hexadecimal floating point literals", - "6" * "2" if $] < "5.028"; - - for my $str (qw/ 0x1.92p+1 0X1.92P+1 - 0x1.92p1 0X1.92P1 - 0x19.2p-3 0X19.2P-3 /) - { - $x = eval $str; - is($x, "3.140625", "hexadecimal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0o" prefix require v5.34.0. - skip "perl v5.34.0 required for octal floating point literals" - . " with '0o' prefix", "6" * "2" if $] < "5.034"; - - for my $str (qw/ 0o1.444p+1 0O1.444P+1 - 0o1.444p1 0O1.444P1 - 0o14.44p-2 0O14.44P-2 /) - { - $x = eval $str; - is($x, "3.140625", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0" prefix require v5.32.0. - skip "perl v5.32.0 required for octal floating point literals", - "6" * "2" if $] < "5.032"; - - for my $str (qw/ 01.444p+1 01.444P+1 - 01.444p1 01.444P1 - 014.44p-2 014.44P-2 /) - { - $x = eval $str; - is($x, "3.140625", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Binary floating point literals require v5.32.0. - skip "perl v5.32.0 required for binary floating point literals", - "6" * "2" if $] < "5.032"; - - for my $str (qw/ 0b1.1001001p+1 0B1.1001001P+1 - 0b1.1001001p1 0B1.1001001P1 - 0b110.01001p-1 0B110.01001P-1 /) - { - $x = eval $str; - is($x, "3.140625", "binary floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} diff --git a/cpan/Math-BigInt/t/const-mbi.t b/cpan/Math-BigInt/t/const-mbi.t deleted file mode 100644 index 17c30c217d..0000000000 --- a/cpan/Math-BigInt/t/const-mbi.t +++ /dev/null @@ -1,235 +0,0 @@ -# -*- mode: perl; -*- - -# Binary, octal, and hexadecimal floating point literals were introduced in -# v5.22.0. -# -# - It wasn't until v5.28.0 that binary, octal, and hexadecimal floating point -# literals were converted to the correct value on perls compiled with quadmath -# support. -# -# - It wasn't until v5.34.0 that binary and octal floating point literals worked -# correctly with constant overloading. Before v5.34.0, it seems like the -# second character is always silently converted to an "x", so, e.g., "0b1.1p8" -# is passed to the overload::constant subroutine as "0x1.1p8", and "01.1p+8" -# is passed as "0x.1p+8". -# -# - Octal floating point literals using the "0o" prefix were introduced in -# v5.34.0. - -# Note that all numeric literals that should not be overloaded must be quoted. - -use strict; -use warnings; - -use Test::More tests => "118"; - -use Math::BigInt ":constant"; - -my $class = "Math::BigInt"; -my $x; - -################################################################################ -# The following tests should be identical for Math::BigInt, Math::BigFloat and -# Math::BigRat. - -# These are handled by "binary". - -$x = 0xff; -is($x, "255", "hexadecimal integer literal 0xff"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Hexadecimal literals using the "0X" prefix require v5.14.0. - skip "perl v5.14.0 required for hexadecimal integer literals" - . " with '0X' prefix", "2" if $] < "5.014"; - - $x = eval "0XFF"; - is($x, "255", "hexadecimal integer literal 0XFF"); - is(ref($x), $class, "value is a $class"); -} - -$x = 0377; -is($x, "255", "octal integer literal 0377"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Octal literals using the "0o" prefix were introduced in v5.34.0. - skip "perl v5.34.0 required for octal floating point literals" - . " with '0o' prefix", "4" if $] < "5.034"; - - for my $str (qw/ 0o377 0O377 /) { - $x = eval $str; - is($x, "255", "octal integer literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -$x = 0b11111111; -is($x, "255", "binary integer literal 0b11111111"); -is(ref($x), $class, "value is a $class"); - -SKIP: { - # Binary literals using the "0B" prefix require v5.14.0. - skip "perl v5.14.0 required for binary integer literals" - . " with '0B' prefix", "2" if $] < "5.014"; - - $x = eval "0B11111111"; - is($x, "255", "binary integer literal 0B11111111"); - is(ref($x), $class, "value is a $class"); -} - -# These are handled by "float". - -$x = 999999999999999999999999999999999999999999999999999999999999999999999999; -is($x, - "999999999999999999999999999999999999999999999999999999999999999999999999", - "decimal integer literal " . ("9" x 72)); -is(ref($x), $class, "value is a $class"); - -$x = 1e72 - 1; -is($x, - "999999999999999999999999999999999999999999999999999999999999999999999999", - "literal 1e72 - 1"); -is(ref($x), $class, "value is a $class"); - -# These are handled by "float". - -SKIP: { - # Hexadecimal floating point literals require v5.28.0. - skip "perl v5.28.0 required for hexadecimal floating point literals", - "6" * "2" + "2" * "2" if $] < "5.028"; - - for my $str (qw/ 0x1.3ap+8 0X1.3AP+8 - 0x1.3ap8 0X1.3AP8 - 0x13a0p-4 0X13A0P-4 /) - { - $x = eval $str; - is($x, "314", "hexadecimal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0x0.0p+8 0X0.0P+8 /) - { - $x = eval $str; - is($x, "0", "hexadecimal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0o" prefix require v5.34.0. - skip "perl v5.34.0 required for octal floating point literals" - . " with '0o' prefix", "6" * "2" + "6" * "2" if $] < "5.034"; - - for my $str (qw/ 0o1.164p+8 0O1.164P+8 - 0o1.164p8 0O1.164P8 - 0o11640p-4 0O11640P-4 /) - { - $x = eval $str; - is($x, "314", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0o0.0p+8 0O0.0P+8 - 0o0.0p8 0O0.0P8 - 0o0.0p-8 0O0.0P-8 /) - { - $x = eval $str; - is($x, "0", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Octal floating point literals using the "0" prefix require v5.32.0. - skip "perl v5.32.0 required for octal floating point literals", - "6" * "2" + "6" * "2" if $] < "5.032"; - - for my $str (qw/ 01.164p+8 01.164P+8 - 01.164p8 01.164P8 - 011640p-4 011640P-4 /) - { - $x = eval $str; - is($x, "314", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 00.0p+8 00.0P+8 - 00.0p8 00.0P8 - 00.0p-8 00.0P-8 /) - { - $x = eval $str; - is($x, "0", "octal floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -SKIP: { - # Binary floating point literals require v5.32.0. - skip "perl v5.32.0 required for binary floating point literals", - "6" * "2" + "6" * "2" if $] < "5.032"; - - for my $str (qw/ 0b1.0011101p+8 0B1.0011101P+8 - 0b1.0011101p8 0B1.0011101P8 - 0b10011101000p-2 0B10011101000P-2 /) - { - $x = eval $str; - is($x, "314", "binary floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } - - for my $str (qw/ 0b0p+8 0B0P+8 - 0b0p8 0B0P8 - 0b0p-8 0B0P-8 - /) - { - $x = eval $str; - is($x, "0", "binary floating point literal $str"); - is(ref($x), $class, "value is a $class"); - } -} - -# These are handled by "integer". - -$x = 314; -is($x, "314", "integer literal 314"); -is(ref($x), $class, "value is a $class"); - -$x = 0; -is($x, "0", "integer literal 0"); -is(ref($x), $class, "value is a $class"); - -$x = 2 ** 255; -is($x, - "578960446186580977117854925043439539266" - . "34992332820282019728792003956564819968", - "2 ** 255"); -is(ref($x), $class, "value is a $class"); - -# These are handled by "binary". - -{ - no warnings "portable"; # protect against "non-portable" warnings - - # hexadecimal constant - $x = 0x123456789012345678901234567890; - is($x, - "94522879687365475552814062743484560", - "hexadecimal constant 0x123456789012345678901234567890"); - is(ref($x), $class, "value is a $class"); - - # octal constant - $x = 012345676543210123456765432101234567654321; - is($x, - "1736132869400711976876385488263403729", - "octal constant 012345676543210123456765432101234567654321"); - is(ref($x), $class, "value is a $class"); - - # binary constant - $x = 0b01010100011001010110110001110011010010010110000101101101; - is($x, - "23755414508757357", - "binary constant 0b0101010001100101011011000111" - . "0011010010010110000101101101"); - is(ref($x), $class, "value is a $class"); -} diff --git a/cpan/Math-BigInt/t/downgrade.t b/cpan/Math-BigInt/t/downgrade.t index c5f34402e4..1d76a76a69 100644 --- a/cpan/Math-BigInt/t/downgrade.t +++ b/cpan/Math-BigInt/t/downgrade.t @@ -5,134 +5,233 @@ use strict; use warnings; -use Test::More tests => 164; +use Test::More tests => 93; use Math::BigInt upgrade => 'Math::BigFloat'; use Math::BigFloat downgrade => 'Math::BigInt'; -# simplistic test for now is(Math::BigFloat->downgrade(), 'Math::BigInt', 'Math::BigFloat->downgrade()'); is(Math::BigInt->upgrade(), 'Math::BigFloat', 'Math::BigInt->upgrade()'); # bug until v1.67: -is(Math::BigFloat->new("0.2E0"), "0.2", qq|Math::BigFloat->new("0.2E0")|); -is(Math::BigFloat->new("0.2E1"), "2", qq|Math::BigFloat->new("0.2E1")|); -# until v1.67 resulted in 200: -is(Math::BigFloat->new("0.2E2"), "20", qq|Math::BigFloat->new("0.2E2")|); - -# disable, otherwise it screws calculations -Math::BigFloat->upgrade(undef); -is(Math::BigFloat->upgrade() || "", "", qq/Math::BigFloat->upgrade() || ""/); - -Math::BigFloat->div_scale(20); # make it a bit faster -my $x = Math::BigFloat->new(2); # downgrades -# the following test upgrade for bsqrt() and also makes new() NOT downgrade -# for the bpow() side -is(Math::BigFloat->bpow("2", "0.5"), $x->bsqrt(), - qq|Math::BigFloat->bpow("2", "0.5")|); + +subtest 'Math::BigFloat->new("0.2E0")' => sub { + plan tests => 2; + my $x = Math::BigFloat->new("0.2E0"); + is($x, "0.2", 'value of $x'); + is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat'); +}; + +subtest 'Math::BigFloat->new("0.2E1")' => sub { + plan tests => 2; + my $x = Math::BigFloat->new("2"); + is($x, "2", 'value of $x'); + is(ref($x), "Math::BigInt", '$x is downgraded to a Math::BigInt'); +}; + +subtest 'Math::BigFloat->new("0.2E2")' => sub { + plan tests => 2; + my $x = Math::BigFloat->new("20"); + is($x, "20", 'value of $x'); + is(ref($x), "Math::BigInt", '$x is downgraded to a Math::BigInt'); +}; + +# $x is a downgraded to a Math::BigInt, but bpow() and bsqrt() upgrades to +# Math::BigFloat. + +Math::BigFloat -> div_scale(20); # make it a bit faster + +my ($x, $y, $z); +subtest '$x = Math::BigFloat -> new(2);' => sub { + plan tests => 2; + $x = Math::BigFloat -> new(2); # downgrades + is(ref($x), 'Math::BigInt', '$x is downgraded to a Math::BigInt'); + cmp_ok($x, "==", 2, 'value of $x'); +}; + +subtest '$y = Math::BigFloat -> bpow("2", "0.5");' => sub { + plan tests => 2; + $y = Math::BigFloat -> bpow("2", "0.5"); + is(ref($y), 'Math::BigFloat', '$y is a Math::BigFloat'); + cmp_ok($y, "==", "1.4142135623730950488", 'value of $y'); +}; + +subtest '$z = $x -> bsqrt();' => sub { + plan tests => 2; + $z = $x -> bsqrt(); + is(ref($z), 'Math::BigFloat', '$y is a Math::BigFloat'); + cmp_ok($z, "==", "1.4142135623730950488", 'value of $z'); +}; + +# log_2(16) = 4 + +subtest '$x = Math::BigFloat -> new(16); $y = $x -> blog(2);' => sub { + plan tests => 4; + $x = Math::BigFloat -> new(16); + is(ref($x), 'Math::BigInt', '$x is downgraded to a Math::BigInt'); + cmp_ok($x, "==", 16, 'value of $x'); + $y = $x -> blog(2); + is(ref($y), 'Math::BigInt', '$y is downgraded to a Math::BigInt'); + cmp_ok($y, "==", 4, 'value of $y'); +}; + +# log_16(2) = 1/4 + +subtest '$x = Math::BigFloat -> new(2); $y = $x -> blog(16);' => sub { + plan tests => 4; + $x = Math::BigFloat -> new(2); + is(ref($x), 'Math::BigInt', '$x is downgraded to a Math::BigInt'); + cmp_ok($x, "==", 2, 'value of $x'); + $y = $x -> blog(16); + is(ref($y), 'Math::BigFloat', '$y is a Math::BigFloat'); + cmp_ok($y, "==", 0.25, 'value of $y'); +}; ################################################################################ # Verify that constructors downgrade when they should. note("Enable downgrading, and see if constructors downgrade"); -Math::BigFloat -> downgrade("Math::BigInt"); - -# new() +note("testing new()"); $x = Math::BigFloat -> new("0.5"); -cmp_ok($x, "==", 0.5); -is(ref $x, "Math::BigFloat", "Creating a 0.5 does not downgrade"); +subtest '$x = Math::BigFloat -> new("0.5")' => sub { + plan tests => 2; + cmp_ok($x, "==", 0.5, 'value of $x'); + is(ref $x, "Math::BigFloat", "does not downgrade from Math::BigFloat"); +}; $x = Math::BigFloat -> new("4"); -cmp_ok($x, "==", 4, 'new("4")'); -is(ref $x, "Math::BigInt", "Creating a 4 downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> new("4")' => sub { + plan tests => 2; + cmp_ok($x, "==", 4, 'value of $x'); + is(ref $x, "Math::BigInt", "downgrades to Math::BigInt"); +}; $x = Math::BigFloat -> new("0"); -cmp_ok($x, "==", 0, 'new("0")'); -is(ref $x, "Math::BigInt", "Creating a 0 downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> new("0")' => sub { + plan tests => 2; + cmp_ok($x, "==", 0, 'value of $x'); + is(ref $x, "Math::BigInt", "downgrades to Math::BigInt"); +}; $x = Math::BigFloat -> new("1"); -cmp_ok($x, "==", 1, 'new("1")'); -is(ref $x, "Math::BigInt", "Creating a 1 downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> new("1")' => sub { + plan tests => 2; + cmp_ok($x, "==", 1, 'value of $x'); + is(ref $x, "Math::BigInt", "downgrades to Math::BigInt"); +}; $x = Math::BigFloat -> new("Inf"); -cmp_ok($x, "==", "Inf", 'new("inf")'); -is(ref $x, "Math::BigInt", "Creating an Inf downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> new("inf")' => sub { + plan tests => 2; + cmp_ok($x, "==", "Inf", 'value of $x'); + is(ref $x, "Math::BigInt", "downgrades to Math::BigInt"); +}; $x = Math::BigFloat -> new("NaN"); -is($x, "NaN", 'new("NaN")'); -is(ref $x, "Math::BigInt", "Creating a NaN downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> new("NaN")' => sub { + plan tests => 2; + is($x, "NaN", ); + is(ref $x, "Math::BigInt", "downgrades to Math::BigInt"); +}; -# bzero() +note("testing bzero()"); $x = Math::BigFloat -> bzero(); -cmp_ok($x, "==", 0, "bzero()"); -is(ref $x, "Math::BigInt", "Creating a 0 downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> bzero()' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; -# bone() +note("testing bone()"); $x = Math::BigFloat -> bone(); -cmp_ok($x, "==", 1, "bone()"); -is(ref $x, "Math::BigInt", "Creating a 1 downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> bone()' => sub { + plan tests => 2; + cmp_ok($x, '==', 1, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; -# binf() +note("testing binf()"); $x = Math::BigFloat -> binf(); -cmp_ok($x, "==", "Inf", "binf()"); -is(ref $x, "Math::BigInt", "Creating an Inf downgrades to Math::BigInt"); +subtest '$x = Math::BigFloat -> binf()' => sub { + plan tests => 2; + cmp_ok($x, '==', 'Inf', 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; -# bnan() +note("testing bnan()"); $x = Math::BigFloat -> bnan(); -is($x, "NaN", "bnan()"); -is(ref $x, "Math::BigInt", "Creating a NaN downgrades to Math::BigInt"); - -# from_dec() - -$x = Math::BigFloat -> from_dec("3.14e2"); -cmp_ok($x, "==", 314, 'from_dec("3.14e2")'); -is(ref $x, "Math::BigInt", 'from_dec("3.14e2") downgrades to Math::BigInt'); - -# from_hex() - -$x = Math::BigFloat -> from_hex("0x1.3ap+8"); -cmp_ok($x, "==", 314, 'from_hex("3.14e2")'); -is(ref $x, "Math::BigInt", 'from_hex("3.14e2") downgrades to Math::BigInt'); - -# from_oct() - -$x = Math::BigFloat -> from_oct("0o1.164p+8"); -cmp_ok($x, "==", 314, 'from_oct("0o1.164p+8")'); -is(ref $x, "Math::BigInt", 'from_oct("0o1.164p+8") downgrades to Math::BigInt'); - -# from_bin() - -$x = Math::BigFloat -> from_bin("0b1.0011101p+8"); -cmp_ok($x, "==", 314, 'from_bin("0b1.0011101p+8")'); -is(ref $x, "Math::BigInt", - 'from_bin("0b1.0011101p+8") downgrades to Math::BigInt'); - -# from_ieee754() +subtest '$x = Math::BigFloat -> bnan()' => sub { + plan tests => 2; + is($x, 'NaN', 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; + +note("testing from_dec()"); + +$x = Math::BigFloat -> from_dec('3.14e2'); +subtest '$x = Math::BigFloat -> from_dec("3.14e2")' => sub { + plan tests => 2; + cmp_ok($x, '==', 314, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; + +note("testing from_hex()"); + +$x = Math::BigFloat -> from_hex('0x1.3ap+8'); +subtest '$x = Math::BigFloat -> from_hex("3.14e2")' => sub { + plan tests => 2; + cmp_ok($x, '==', 314, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; + +note("testing from_oct()"); + +$x = Math::BigFloat -> from_oct('0o1.164p+8'); +subtest '$x = Math::BigFloat -> from_oct("0o1.164p+8")' => sub { + plan tests => 2; + cmp_ok($x, '==', 314, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; + +note("testing from_bin()"); + +$x = Math::BigFloat -> from_bin('0b1.0011101p+8'); +subtest '$x = Math::BigFloat -> from_bin("0b1.0011101p+8")' => sub { + plan tests => 2; + cmp_ok($x, '==', 314, 'value of $x'); + is(ref $x, 'Math::BigInt', 'downgrades to Math::BigInt'); +}; + +note("testing from_ieee754()"); $x = Math::BigFloat -> from_ieee754("\x43\x9d\x00\x00", "binary32"); -cmp_ok($x, "==", 314, 'from_ieee754("\x43\x9d\x00\x00", "binary32")'); -is(ref $x, "Math::BigInt", - 'from_ieee754("\x43\x9d\x00\x00", "binary32") downgrades to Math::BigInt'); +subtest '$x = Math::BigFloat -> from_ieee754("\x43\x9d\x00\x00", "binary32")' => sub { + plan tests => 2; + cmp_ok($x, "==", 314, 'value of $x'); + is(ref $x, "Math::BigInt", 'downgrades to Math::BigInt'); +}; note("Disable downgrading, and see if constructors downgrade"); Math::BigFloat -> downgrade(undef); +my $zero = Math::BigFloat -> bzero(); my $half = Math::BigFloat -> new("0.5"); +my $one = Math::BigFloat -> bone(); my $four = Math::BigFloat -> new("4"); -my $zero = Math::BigFloat -> bzero(); my $inf = Math::BigFloat -> binf(); my $nan = Math::BigFloat -> bnan(); +is(ref $zero, "Math::BigFloat", "Creating a 0 does not downgrade"); is(ref $half, "Math::BigFloat", "Creating a 0.5 does not downgrade"); +is(ref $one, "Math::BigFloat", "Creating a 1 does not downgrade"); is(ref $four, "Math::BigFloat", "Creating a 4 does not downgrade"); -is(ref $zero, "Math::BigFloat", "Creating a 0 does not downgrade"); is(ref $inf, "Math::BigFloat", "Creating an Inf does not downgrade"); is(ref $nan, "Math::BigFloat", "Creating a NaN does not downgrade"); @@ -141,352 +240,536 @@ is(ref $nan, "Math::BigFloat", "Creating a NaN does not downgrade"); Math::BigFloat -> downgrade("Math::BigInt"); -# This shouldn't be necessary, but it is. Fixme! - -Math::BigInt -> upgrade(undef); - -# bneg() +note("testing bneg()"); $x = $zero -> copy() -> bneg(); -cmp_ok($x, "==", 0, "-(0) = 0"); -is(ref($x), "Math::BigInt", "-(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bneg();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, '-(0) = 0'); + is(ref($x), 'Math::BigInt', '-(0) => Math::BigInt'); +}; $x = $four -> copy() -> bneg(); -cmp_ok($x, "==", -4, "-(4) = -4"); -is(ref($x), "Math::BigInt", "-(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bneg();' => sub { + plan tests => 2; + cmp_ok($x, '==', -4, '-(4) = -4'); + is(ref($x), 'Math::BigInt', '-(4) => Math::BigInt'); +}; $x = $inf -> copy() -> bneg(); -cmp_ok($x, "==", "-inf", "-(Inf) = -Inf"); -is(ref($x), "Math::BigInt", "-(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bneg();' => sub { + plan tests => 2; + cmp_ok($x, '==', '-inf', '-(Inf) = -Inf'); + is(ref($x), 'Math::BigInt', '-(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bneg(); -is($x, "NaN", "-(NaN) = NaN"); -is(ref($x), "Math::BigInt", "-(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bneg();' => sub { + plan tests => 2; + is($x, 'NaN', '-(NaN) = NaN'); + is(ref($x), 'Math::BigInt', '-(NaN) => Math::BigInt'); +}; -# bnorm() +note("testing bnorm()"); $x = $zero -> copy() -> bnorm(); -cmp_ok($x, "==", 0, "bnorm(0)"); -is(ref($x), "Math::BigInt", "bnorm(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bnorm();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'value of $x'); + is(ref($x), 'Math::BigInt', 'bnorm(0) => Math::BigInt'); +}; $x = $four -> copy() -> bnorm(); -cmp_ok($x, "==", 4, "bnorm(4)"); -is(ref($x), "Math::BigInt", "bnorm(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bnorm();' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, 'value of $x'); + is(ref($x), 'Math::BigInt', 'bnorm(4) => Math::BigInt'); +}; $x = $inf -> copy() -> bnorm(); -cmp_ok($x, "==", "inf", "bnorm(Inf)"); -is(ref($x), "Math::BigInt", "bnorm(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bnorm();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'value of $x'); + is(ref($x), 'Math::BigInt', 'bnorm(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bnorm(); -is($x, "NaN", "bnorm(NaN)"); -is(ref($x), "Math::BigInt", "bnorm(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bnorm();' => sub { + plan tests => 2; + is($x, 'NaN', 'bnorm(NaN)'); + is(ref($x), 'Math::BigInt', 'bnorm(NaN) => Math::BigInt'); +}; -# binc() +note("testing binc()"); $x = $zero -> copy() -> binc(); -cmp_ok($x, "==", 1, "binc(0)"); -is(ref($x), "Math::BigInt", "binc(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> binc();' => sub { + plan tests => 2; + cmp_ok($x, '==', 1, 'binc(0)'); + is(ref($x), 'Math::BigInt', 'binc(0) => Math::BigInt'); +}; $x = $four -> copy() -> binc(); -cmp_ok($x, "==", 5, "binc(4)"); -is(ref($x), "Math::BigInt", "binc(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> binc();' => sub { + plan tests => 2; + cmp_ok($x, '==', 5, 'binc(4)'); + is(ref($x), 'Math::BigInt', 'binc(4) => Math::BigInt'); +}; $x = $inf -> copy() -> binc(); -cmp_ok($x, "==", "inf", "binc(Inf)"); -is(ref($x), "Math::BigInt", "binc(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> binc();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'binc(Inf)'); + is(ref($x), 'Math::BigInt', 'binc(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> binc(); -is($x, "NaN", "binc(NaN)"); -is(ref($x), "Math::BigInt", "binc(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> binc();' => sub { + plan tests => 2; + is($x, 'NaN', 'binc(NaN)'); + is(ref($x), 'Math::BigInt', 'binc(NaN) => Math::BigInt'); +}; -# bdec() +note("testing bdec()"); $x = $zero -> copy() -> bdec(); -cmp_ok($x, "==", -1, "bdec(0)"); -is(ref($x), "Math::BigInt", "bdec(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bdec();' => sub { + plan tests => 2; + cmp_ok($x, '==', -1, 'bdec(0)'); + is(ref($x), 'Math::BigInt', 'bdec(0) => Math::BigInt'); +}; $x = $four -> copy() -> bdec(); -cmp_ok($x, "==", 3, "bdec(4)"); -is(ref($x), "Math::BigInt", "bdec(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bdec();' => sub { + plan tests => 2; + cmp_ok($x, '==', 3, 'bdec(4)'); + is(ref($x), 'Math::BigInt', 'bdec(4) => Math::BigInt'); +}; $x = $inf -> copy() -> bdec(); -cmp_ok($x, "==", "inf", "bdec(Inf)"); -is(ref($x), "Math::BigInt", "bdec(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bdec();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bdec(Inf)'); + is(ref($x), 'Math::BigInt', 'bdec(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bdec(); -is($x, "NaN", "bdec(NaN)"); -is(ref($x), "Math::BigInt", "bdec(NaN) => Math::BigInt"); +subtest '' => sub { + plan tests => 2; + is($x, 'NaN', 'bdec(NaN)'); + is(ref($x), 'Math::BigInt', 'bdec(NaN) => Math::BigInt'); +}; -# badd() +note("testing badd()"); $x = $half -> copy() -> badd($nan); -is($x, "NaN", "0.5 + NaN = NaN"); -is(ref($x), "Math::BigInt", "0.5 + NaN => Math::BigInt"); +subtest '$x = $half -> copy() -> badd($nan);' => sub { + plan tests => 2; + is($x, 'NaN', '0.5 + NaN = NaN'); + is(ref($x), 'Math::BigInt', '0.5 + NaN => Math::BigInt'); +}; $x = $half -> copy() -> badd($inf); -cmp_ok($x, "==", "+Inf", "0.5 + Inf = Inf"); -is(ref($x), "Math::BigInt", "2.5 + Inf => Math::BigInt"); +subtest '$x = $half -> copy() -> badd($inf);' => sub { + plan tests => 2; + cmp_ok($x, '==', '+Inf', '0.5 + Inf = Inf'); + is(ref($x), 'Math::BigInt', '2.5 + Inf => Math::BigInt'); +}; $x = $half -> copy() -> badd($half); -cmp_ok($x, "==", 1, "0.5 + 0.5 = 1"); -is(ref($x), "Math::BigInt", "0.5 + 0.5 => Math::BigInt"); +subtest '$x = $half -> copy() -> badd($half);' => sub { + plan tests => 2; + cmp_ok($x, '==', 1, '0.5 + 0.5 = 1'); + is(ref($x), 'Math::BigInt', '0.5 + 0.5 => Math::BigInt'); +}; $x = $half -> copy() -> badd($half -> copy() -> bneg()); -cmp_ok($x, "==", 0, "0.5 + -0.5 = 0"); -is(ref($x), "Math::BigInt", "0.5 + -0.5 => Math::BigInt"); +subtest '$x = $half -> copy() -> badd($half -> copy() -> bneg());' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, '0.5 + -0.5 = 0'); + is(ref($x), 'Math::BigInt', '0.5 + -0.5 => Math::BigInt'); +}; $x = $four -> copy() -> badd($zero); -cmp_ok($x, "==", 4, "4 + 0 = 4"); -is(ref($x), "Math::BigInt", "4 + 0 => Math::BigInt"); +subtest '$x = $four -> copy() -> badd($zero);' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, '4 + 0 = 4'); + is(ref($x), 'Math::BigInt', '4 + 0 => Math::BigInt'); +}; $x = $zero -> copy() -> badd($four); -cmp_ok($x, "==", 4, "0 + 4 = 4"); -is(ref($x), "Math::BigInt", "0 + 4 => Math::BigInt"); +subtest '$x = $zero -> copy() -> badd($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, '0 + 4 = 4'); + is(ref($x), 'Math::BigInt', '0 + 4 => Math::BigInt'); +}; $x = $inf -> copy() -> badd($four); -cmp_ok($x, "==", "+Inf", "Inf + 4 = Inf"); -is(ref($x), "Math::BigInt", "Inf + 4 => Math::BigInt"); +subtest '$x = $inf -> copy() -> badd($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', '+Inf', 'Inf + 4 = Inf'); + is(ref($x), 'Math::BigInt', 'Inf + 4 => Math::BigInt'); +}; $x = $nan -> copy() -> badd($four); -is($x, "NaN", "NaN + 4 = NaN"); -is(ref($x), "Math::BigInt", "NaN + 4 => Math::BigInt"); +subtest '$x = $nan -> copy() -> badd($four);' => sub { + plan tests => 2; + is($x, 'NaN', 'NaN + 4 = NaN'); + is(ref($x), 'Math::BigInt', 'NaN + 4 => Math::BigInt'); +}; -# bsub() +note("testing bsub()"); $x = $half -> copy() -> bsub($nan); -is($x, "NaN", "0.5 - NaN = NaN"); -is(ref($x), "Math::BigInt", "0.5 - NaN => Math::BigInt"); +subtest '$x = $half -> copy() -> bsub($nan);' => sub { + plan tests => 2; + is($x, 'NaN', '0.5 - NaN = NaN'); + is(ref($x), 'Math::BigInt', '0.5 - NaN => Math::BigInt'); +}; $x = $half -> copy() -> bsub($inf); -cmp_ok($x, "==", "-Inf", "2.5 - Inf = -Inf"); -is(ref($x), "Math::BigInt", "2.5 - Inf => Math::BigInt"); +subtest '$x = $half -> copy() -> bsub($inf);' => sub { + plan tests => 2; + cmp_ok($x, '==', '-Inf', '2.5 - Inf = -Inf'); + is(ref($x), 'Math::BigInt', '2.5 - Inf => Math::BigInt'); +}; $x = $half -> copy() -> bsub($half); -cmp_ok($x, "==", 0, "0.5 + 0.5 = 0"); -is(ref($x), "Math::BigInt", "0.5 - 0.5 => Math::BigInt"); +subtest '$x = $half -> copy() -> bsub($half);' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, '0.5 + 0.5 = 0'); + is(ref($x), 'Math::BigInt', '0.5 - 0.5 => Math::BigInt'); +}; $x = $half -> copy() -> bsub($half -> copy() -> bneg()); -cmp_ok($x, "==", 1, "0.5 - -0.5 = 1"); -is(ref($x), "Math::BigInt", "0.5 - -0.5 => Math::BigInt"); +subtest '$x = $half -> copy() -> bsub($half -> copy() -> bneg());' => sub { + plan tests => 2; + cmp_ok($x, '==', 1, '0.5 - -0.5 = 1'); + is(ref($x), 'Math::BigInt', '0.5 - -0.5 => Math::BigInt'); +}; $x = $four -> copy() -> bsub($zero); -cmp_ok($x, "==", 4, "4 - 0 = 4"); -is(ref($x), "Math::BigInt", "4 - 0 => Math::BigInt"); +subtest '$x = $four -> copy() -> bsub($zero);' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, '4 - 0 = 4'); + is(ref($x), 'Math::BigInt', '4 - 0 => Math::BigInt'); +}; $x = $zero -> copy() -> bsub($four); -cmp_ok($x, "==", -4, "0 - 4 = -4"); -is(ref($x), "Math::BigInt", "0 - 4 => Math::BigInt"); +subtest '$x = $zero -> copy() -> bsub($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', -4, '0 - 4 = -4'); + is(ref($x), 'Math::BigInt', '0 - 4 => Math::BigInt'); +}; $x = $inf -> copy() -> bsub($four); -cmp_ok($x, "==", "Inf", "Inf - 4 = Inf"); -is(ref($x), "Math::BigInt", "Inf - 4 => Math::BigInt"); +subtest '$x = $inf -> copy() -> bsub($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 'Inf', 'Inf - 4 = Inf'); + is(ref($x), 'Math::BigInt', 'Inf - 4 => Math::BigInt'); +}; $x = $nan -> copy() -> bsub($four); -is($x, "NaN", "NaN - 4 = NaN"); -is(ref($x), "Math::BigInt", "NaN - 4 => Math::BigInt"); +subtest '$x = $nan -> copy() -> bsub($four);' => sub { + plan tests => 2; + is($x, 'NaN', 'NaN - 4 = NaN'); + is(ref($x), 'Math::BigInt', 'NaN - 4 => Math::BigInt'); +}; -# bmul() +note("testing bmul()"); $x = $zero -> copy() -> bmul($four); -cmp_ok($x, "==", 0, "bmul(0, 4) = 0"); -is(ref($x), "Math::BigInt", "bmul(0, 4) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bmul($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bmul(0, 4) = 0'); + is(ref($x), 'Math::BigInt', 'bmul(0, 4) => Math::BigInt'); +}; $x = $four -> copy() -> bmul($four); -cmp_ok($x, "==", 16, "bmul(4, 4) = 16"); -is(ref($x), "Math::BigInt", "bmul(4, 4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bmul($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 16, 'bmul(4, 4) = 16'); + is(ref($x), 'Math::BigInt', 'bmul(4, 4) => Math::BigInt'); +}; $x = $inf -> copy() -> bmul($four); -cmp_ok($x, "==", "inf", "bmul(Inf, 4) = Inf"); -is(ref($x), "Math::BigInt", "bmul(Inf, 4) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bmul($four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bmul(Inf, 4) = Inf'); + is(ref($x), 'Math::BigInt', 'bmul(Inf, 4) => Math::BigInt'); +}; $x = $nan -> copy() -> bmul($four); -is($x, "NaN", "bmul(NaN, 4) = NaN"); -is(ref($x), "Math::BigInt", "bmul(NaN, 4) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bmul($four);' => sub { + plan tests => 2; + is($x, 'NaN', 'bmul(NaN, 4) = NaN'); + is(ref($x), 'Math::BigInt', 'bmul(NaN, 4) => Math::BigInt'); +}; -$x = $four -> copy() -> bmul("0.5"); -cmp_ok($x, "==", 2, "bmul(4, 0.5) = 2"); -is(ref($x), "Math::BigInt", "bmul(4, 0.5) => Math::BigInt"); +$x = $four -> copy() -> bmul('0.5'); +subtest '' => sub { + plan tests => 2; + cmp_ok($x, '==', 2, 'bmul(4, 0.5) = 2'); + is(ref($x), 'Math::BigInt', 'bmul(4, 0.5) => Math::BigInt'); +}; -# bmuladd() +note("testing bmuladd()"); $x = $zero -> copy() -> bmuladd($four, $four); -cmp_ok($x, "==", 4, "bmuladd(0, 4, 4) = 4"); -is(ref($x), "Math::BigInt", "bmuladd(0, 4, 4) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bmuladd($four, $four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, 'bmuladd(0, 4, 4) = 4'); + is(ref($x), 'Math::BigInt', 'bmuladd(0, 4, 4) => Math::BigInt'); +}; $x = $four -> copy() -> bmuladd($four, $four); -cmp_ok($x, "==", 20, "bmuladd(4, 4, 4) = 20"); -is(ref($x), "Math::BigInt", "bmuladd(4, 4, 4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bmuladd($four, $four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 20, 'bmuladd(4, 4, 4) = 20'); + is(ref($x), 'Math::BigInt', 'bmuladd(4, 4, 4) => Math::BigInt'); +}; $x = $four -> copy() -> bmuladd($four, $inf); -cmp_ok($x, "==", "inf", "bmuladd(4, 4, Inf) = Inf"); -is(ref($x), "Math::BigInt", "bmuladd(4, 4, Inf) => Math::BigInt"); +subtest '$x = $four -> copy() -> bmuladd($four, $inf);' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bmuladd(4, 4, Inf) = Inf'); + is(ref($x), 'Math::BigInt', 'bmuladd(4, 4, Inf) => Math::BigInt'); +}; $x = $inf -> copy() -> bmuladd($four, $four); -cmp_ok($x, "==", "inf", "bmuladd(Inf, 4, 4) = Inf"); -is(ref($x), "Math::BigInt", "bmuladd(Inf, 4, 4) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bmuladd($four, $four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bmuladd(Inf, 4, 4) = Inf'); + is(ref($x), 'Math::BigInt', 'bmuladd(Inf, 4, 4) => Math::BigInt'); +}; $x = $inf -> copy() -> bmuladd($four, $four); -cmp_ok($x, "==", "inf", "bmuladd(Inf, 4, 4) = Inf"); -is(ref($x), "Math::BigInt", "bmuladd(Inf, 4, 4) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bmuladd($four, $four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bmuladd(Inf, 4, 4) = Inf'); + is(ref($x), 'Math::BigInt', 'bmuladd(Inf, 4, 4) => Math::BigInt'); +}; $x = $nan -> copy() -> bmuladd($four, $four); -is($x, "NaN", "bmuladd(NaN, 4, 4) = NaN"); -is(ref($x), "Math::BigInt", "bmuladd(NaN, 4, 4) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bmuladd($four, $four);' => sub { + plan tests => 2; + is($x, 'NaN', 'bmuladd(NaN, 4, 4) = NaN'); + is(ref($x), 'Math::BigInt', 'bmuladd(NaN, 4, 4) => Math::BigInt'); +}; $x = $four -> copy() -> bmuladd("0.5", $four); -cmp_ok($x, "==", 6, "bmuladd(4, 0.5, 4) = 6"); -is(ref($x), "Math::BigInt", "bmuladd(4, 0.5, 4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bmuladd("0.5", $four);' => sub { + plan tests => 2; + cmp_ok($x, '==', 6, 'bmuladd(4, 0.5, 4) = 6'); + is(ref($x), 'Math::BigInt', 'bmuladd(4, 0.5, 4) => Math::BigInt'); +}; -# bdiv() +note("testing bdiv()"); -# bmod() +$x = $zero -> copy() -> bdiv($one); +subtest '$x = $zero -> copy() -> bdiv($one);' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bdiv(0, 1) = 0'); + is(ref($x), 'Math::BigInt', 'bdiv(0, 1) => Math::BigInt'); +}; -# bmodpow() +note("testing bmod()"); -# bpow() +note("testing bmodpow()"); -# blog() +note("testing bpow()"); -# bexp() +note("testing blog()"); -# bnok() +note("testing bexp()"); -# bsin() +note("testing bnok()"); -# bcos() +note("testing bsin()"); -# batan() +note("testing bcos()"); -# batan() +note("testing batan()"); -# bsqrt() +note("testing batan()"); -# broot() +note("testing bsqrt()"); -# bfac() +note("testing broot()"); -# bdfac() +note("testing bfac()"); -# btfac() +note("testing bdfac()"); -# bmfac() +note("testing btfac()"); -# blsft() +note("testing bmfac()"); -# brsft() +note("testing blsft()"); -# band() +note("testing brsft()"); -# bior() +note("testing band()"); -# bxor() +note("testing bior()"); -# bnot() +note("testing bxor()"); -# bround() +note("testing bnot()"); -# Add tests for rounding a non-integer to an integer. Fixme! +note("testing bround()"); + +note("testing Add tests for rounding a non-integer to an integer. Fixme!"); $x = $zero -> copy() -> bround(); -cmp_ok($x, "==", 0, "bround(0)"); -is(ref($x), "Math::BigInt", "bround(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bround(0)'); + is(ref($x), 'Math::BigInt', 'bround(0) => Math::BigInt'); +}; $x = $four -> copy() -> bround(); -cmp_ok($x, "==", 4, "bround(4)"); -is(ref($x), "Math::BigInt", "bround(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, 'bround(4)'); + is(ref($x), 'Math::BigInt', 'bround(4) => Math::BigInt'); +}; $x = $inf -> copy() -> bround(); -cmp_ok($x, "==", "inf", "bround(Inf)"); -is(ref($x), "Math::BigInt", "bround(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bround(Inf)'); + is(ref($x), 'Math::BigInt', 'bround(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bround(); -is($x, "NaN", "bround(NaN)"); -is(ref($x), "Math::BigInt", "bround(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bround();' => sub { + plan tests => 2; + is($x, 'NaN', 'bround(NaN)'); + is(ref($x), 'Math::BigInt', 'bround(NaN) => Math::BigInt'); +}; -# bfround() +note("testing bfround()"); -# Add tests for rounding a non-integer to an integer. Fixme! +note("testing Add tests for rounding a non-integer to an integer. Fixme!"); $x = $zero -> copy() -> bfround(); -cmp_ok($x, "==", 0, "bfround(0)"); -is(ref($x), "Math::BigInt", "bfround(0) => Math::BigInt"); +subtest '$x = $zero -> copy() -> bfround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bfround(0)'); + is(ref($x), 'Math::BigInt', 'bfround(0) => Math::BigInt'); +}; $x = $four -> copy() -> bfround(); -cmp_ok($x, "==", 4, "bfround(4)"); -is(ref($x), "Math::BigInt", "bfround(4) => Math::BigInt"); +subtest '$x = $four -> copy() -> bfround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 4, 'bfround(4)'); + is(ref($x), 'Math::BigInt', 'bfround(4) => Math::BigInt'); +}; $x = $inf -> copy() -> bfround(); -cmp_ok($x, "==", "inf", "bfround(Inf)"); -is(ref($x), "Math::BigInt", "bfround(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bfround();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'inf', 'bfround(Inf)'); + is(ref($x), 'Math::BigInt', 'bfround(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bfround(); -is($x, "NaN", "bfround(NaN)"); -is(ref($x), "Math::BigInt", "bfround(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bfround();' => sub { + plan tests => 2; + is($x, 'NaN', 'bfround(NaN)'); + is(ref($x), 'Math::BigInt', 'bfround(NaN) => Math::BigInt'); +}; -# bfloor() +note("testing bfloor()"); $x = $half -> copy() -> bfloor(); -cmp_ok($x, "==", 0, "bfloor(0)"); -is(ref($x), "Math::BigInt", "bfloor(0) => Math::BigInt"); +subtest '$x = $half -> copy() -> bfloor();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bfloor(0)'); + is(ref($x), 'Math::BigInt', 'bfloor(0) => Math::BigInt'); +}; $x = $inf -> copy() -> bfloor(); -cmp_ok($x, "==", "Inf", "bfloor(Inf)"); -is(ref($x), "Math::BigInt", "bfloor(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bfloor();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'Inf', 'bfloor(Inf)'); + is(ref($x), 'Math::BigInt', 'bfloor(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bfloor(); -is($x, "NaN", "bfloor(NaN)"); -is(ref($x), "Math::BigInt", "bfloor(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bfloor();' => sub { + plan tests => 2; + is($x, 'NaN', 'bfloor(NaN)'); + is(ref($x), 'Math::BigInt', 'bfloor(NaN) => Math::BigInt'); +}; -# bceil() +note("testing bceil()"); $x = $half -> copy() -> bceil(); -cmp_ok($x, "==", 1, "bceil(0)"); -is(ref($x), "Math::BigInt", "bceil(0) => Math::BigInt"); +subtest '$x = $half -> copy() -> bceil();' => sub { + plan tests => 2; + cmp_ok($x, '==', 1, 'bceil(0)'); + is(ref($x), 'Math::BigInt', 'bceil(0) => Math::BigInt'); +}; $x = $inf -> copy() -> bceil(); -cmp_ok($x, "==", "Inf", "bceil(Inf)"); -is(ref($x), "Math::BigInt", "bceil(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bceil();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'Inf', 'bceil(Inf)'); + is(ref($x), 'Math::BigInt', 'bceil(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bceil(); -is($x, "NaN", "bceil(NaN)"); -is(ref($x), "Math::BigInt", "bceil(NaN) => Math::BigInt"); +subtest '$x = $nan -> copy() -> bceil();' => sub { + plan tests => 2; + is($x, 'NaN', 'bceil(NaN)'); + is(ref($x), 'Math::BigInt', 'bceil(NaN) => Math::BigInt'); +}; -# bint() +note("testing bint()"); $x = $half -> copy() -> bint(); -cmp_ok($x, "==", 0, "bint(0)"); -is(ref($x), "Math::BigInt", "bint(0) => Math::BigInt"); +subtest '$x = $half -> copy() -> bint();' => sub { + plan tests => 2; + cmp_ok($x, '==', 0, 'bint(0)'); + is(ref($x), 'Math::BigInt', 'bint(0) => Math::BigInt'); +}; $x = $inf -> copy() -> bint(); -cmp_ok($x, "==", "Inf", "bint(Inf)"); -is(ref($x), "Math::BigInt", "bint(Inf) => Math::BigInt"); +subtest '$x = $inf -> copy() -> bint();' => sub { + plan tests => 2; + cmp_ok($x, '==', 'Inf', 'bint(Inf)'); + is(ref($x), 'Math::BigInt', 'bint(Inf) => Math::BigInt'); +}; $x = $nan -> copy() -> bint(); -is($x, "NaN", "bint(NaN)"); -is(ref($x), "Math::BigInt", "bint(NaN) => Math::BigInt"); - -# bgcd() +subtest '$x = $nan -> copy() -> bint();' => sub { + plan tests => 2; + is($x, 'NaN', 'bint(NaN)'); + is(ref($x), 'Math::BigInt', 'bint(NaN) => Math::BigInt'); +}; -# blcm() +note("testing bgcd()"); -# mantissa() ? +note("testing blcm()"); -# exponent() ? +note("testing mantissa()"); -# parts() ? +note("testing exponent()"); -# sparts() +note("testing parts()"); -# nparts() +note("testing sparts()"); -# eparts() +note("testing nparts()"); -# dparts() +note("testing eparts()"); -# fparts() +note("testing dparts()"); -# numerator() +note("testing fparts()"); -# denominator() +note("testing numerator()"); -#require 'upgrade.inc'; # all tests here for sharing +note("testing denominator()"); diff --git a/cpan/Math-BigInt/t/dparts-mbf.t b/cpan/Math-BigInt/t/dparts-mbf.t deleted file mode 100644 index 43bdd22b76..0000000000 --- a/cpan/Math-BigInt/t/dparts-mbf.t +++ /dev/null @@ -1,294 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1840; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $int_str, $frc_str) = split /:/; - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| (\$i, \$f) = \$x -> dparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my ($int_got, $frc_got) = $x -> dparts(); - - isa_ok($int_got, "Math::BigFloat"); - isa_ok($frc_got, "Math::BigFloat"); - - is($int_got, $int_str, "value of integer part"); - is($frc_got, $frc_str, "value of fraction part"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| \$i = \$x -> dparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my $int_got = $x -> dparts(); - - isa_ok($int_got, "Math::BigFloat"); - - is($int_got, $int_str, "value of integer part"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:0 - -inf:inf:0 --inf:-inf:0 - -0:0:0 - -# positive numbers - -0.000000000001:0:0.000000000001 -0.00000000001:0:0.00000000001 -0.0000000001:0:0.0000000001 -0.000000001:0:0.000000001 -0.00000001:0:0.00000001 -0.0000001:0:0.0000001 -0.000001:0:0.000001 -0.00001:0:0.00001 -0.0001:0:0.0001 -0.001:0:0.001 -0.01:0:0.01 -0.1:0:0.1 -1:1:0 -10:10:0 -100:100:0 -1000:1000:0 -10000:10000:0 -100000:100000:0 -1000000:1000000:0 -10000000:10000000:0 -100000000:100000000:0 -1000000000:1000000000:0 -10000000000:10000000000:0 -100000000000:100000000000:0 -1000000000000:1000000000000:0 - -0.0000000000012:0:0.0000000000012 -0.000000000012:0:0.000000000012 -0.00000000012:0:0.00000000012 -0.0000000012:0:0.0000000012 -0.000000012:0:0.000000012 -0.00000012:0:0.00000012 -0.0000012:0:0.0000012 -0.000012:0:0.000012 -0.00012:0:0.00012 -0.0012:0:0.0012 -0.012:0:0.012 -0.12:0:0.12 -1.2:1:0.2 -12:12:0 -120:120:0 -1200:1200:0 -12000:12000:0 -120000:120000:0 -1200000:1200000:0 -12000000:12000000:0 -120000000:120000000:0 -1200000000:1200000000:0 -12000000000:12000000000:0 -120000000000:120000000000:0 -1200000000000:1200000000000:0 - -0.00000000000123:0:0.00000000000123 -0.0000000000123:0:0.0000000000123 -0.000000000123:0:0.000000000123 -0.00000000123:0:0.00000000123 -0.0000000123:0:0.0000000123 -0.000000123:0:0.000000123 -0.00000123:0:0.00000123 -0.0000123:0:0.0000123 -0.000123:0:0.000123 -0.00123:0:0.00123 -0.0123:0:0.0123 -0.123:0:0.123 -1.23:1:0.23 -12.3:12:0.3 -123:123:0 -1230:1230:0 -12300:12300:0 -123000:123000:0 -1230000:1230000:0 -12300000:12300000:0 -123000000:123000000:0 -1230000000:1230000000:0 -12300000000:12300000000:0 -123000000000:123000000000:0 -1230000000000:1230000000000:0 - -0.000000000001234:0:0.000000000001234 -0.00000000001234:0:0.00000000001234 -0.0000000001234:0:0.0000000001234 -0.000000001234:0:0.000000001234 -0.00000001234:0:0.00000001234 -0.0000001234:0:0.0000001234 -0.000001234:0:0.000001234 -0.00001234:0:0.00001234 -0.0001234:0:0.0001234 -0.001234:0:0.001234 -0.01234:0:0.01234 -0.1234:0:0.1234 -1.234:1:0.234 -12.34:12:0.34 -123.4:123:0.4 -1234:1234:0 -12340:12340:0 -123400:123400:0 -1234000:1234000:0 -12340000:12340000:0 -123400000:123400000:0 -1234000000:1234000000:0 -12340000000:12340000000:0 -123400000000:123400000000:0 -1234000000000:1234000000000:0 - -0.000003141592:0:0.000003141592 -0.00003141592:0:0.00003141592 -0.0003141592:0:0.0003141592 -0.003141592:0:0.003141592 -0.03141592:0:0.03141592 -0.3141592:0:0.3141592 -3.141592:3:0.141592 -31.41592:31:0.41592 -314.1592:314:0.1592 -3141.592:3141:0.592 -31415.92:31415:0.92 -314159.2:314159:0.2 -3141592:3141592:0 - -# negative numbers - --0.000000000001:0:-0.000000000001 --0.00000000001:0:-0.00000000001 --0.0000000001:0:-0.0000000001 --0.000000001:0:-0.000000001 --0.00000001:0:-0.00000001 --0.0000001:0:-0.0000001 --0.000001:0:-0.000001 --0.00001:0:-0.00001 --0.0001:0:-0.0001 --0.001:0:-0.001 --0.01:0:-0.01 --0.1:0:-0.1 --1:-1:0 --10:-10:0 --100:-100:0 --1000:-1000:0 --10000:-10000:0 --100000:-100000:0 --1000000:-1000000:0 --10000000:-10000000:0 --100000000:-100000000:0 --1000000000:-1000000000:0 --10000000000:-10000000000:0 --100000000000:-100000000000:0 --1000000000000:-1000000000000:0 - --0.0000000000012:0:-0.0000000000012 --0.000000000012:0:-0.000000000012 --0.00000000012:0:-0.00000000012 --0.0000000012:0:-0.0000000012 --0.000000012:0:-0.000000012 --0.00000012:0:-0.00000012 --0.0000012:0:-0.0000012 --0.000012:0:-0.000012 --0.00012:0:-0.00012 --0.0012:0:-0.0012 --0.012:0:-0.012 --0.12:0:-0.12 --1.2:-1:-0.2 --12:-12:0 --120:-120:0 --1200:-1200:0 --12000:-12000:0 --120000:-120000:0 --1200000:-1200000:0 --12000000:-12000000:0 --120000000:-120000000:0 --1200000000:-1200000000:0 --12000000000:-12000000000:0 --120000000000:-120000000000:0 --1200000000000:-1200000000000:0 - --0.00000000000123:0:-0.00000000000123 --0.0000000000123:0:-0.0000000000123 --0.000000000123:0:-0.000000000123 --0.00000000123:0:-0.00000000123 --0.0000000123:0:-0.0000000123 --0.000000123:0:-0.000000123 --0.00000123:0:-0.00000123 --0.0000123:0:-0.0000123 --0.000123:0:-0.000123 --0.00123:0:-0.00123 --0.0123:0:-0.0123 --0.123:0:-0.123 --1.23:-1:-0.23 --12.3:-12:-0.3 --123:-123:0 --1230:-1230:0 --12300:-12300:0 --123000:-123000:0 --1230000:-1230000:0 --12300000:-12300000:0 --123000000:-123000000:0 --1230000000:-1230000000:0 --12300000000:-12300000000:0 --123000000000:-123000000000:0 --1230000000000:-1230000000000:0 - --0.000000000001234:0:-0.000000000001234 --0.00000000001234:0:-0.00000000001234 --0.0000000001234:0:-0.0000000001234 --0.000000001234:0:-0.000000001234 --0.00000001234:0:-0.00000001234 --0.0000001234:0:-0.0000001234 --0.000001234:0:-0.000001234 --0.00001234:0:-0.00001234 --0.0001234:0:-0.0001234 --0.001234:0:-0.001234 --0.01234:0:-0.01234 --0.1234:0:-0.1234 --1.234:-1:-0.234 --12.34:-12:-0.34 --123.4:-123:-0.4 --1234:-1234:0 --12340:-12340:0 --123400:-123400:0 --1234000:-1234000:0 --12340000:-12340000:0 --123400000:-123400000:0 --1234000000:-1234000000:0 --12340000000:-12340000000:0 --123400000000:-123400000000:0 --1234000000000:-1234000000000:0 - --0.000003141592:0:-0.000003141592 --0.00003141592:0:-0.00003141592 --0.0003141592:0:-0.0003141592 --0.003141592:0:-0.003141592 --0.03141592:0:-0.03141592 --0.3141592:0:-0.3141592 --3.141592:-3:-0.141592 --31.41592:-31:-0.41592 --314.1592:-314:-0.1592 --3141.592:-3141:-0.592 --31415.92:-31415:-0.92 --314159.2:-314159:-0.2 --3141592:-3141592:0 diff --git a/cpan/Math-BigInt/t/dparts-mbi.t b/cpan/Math-BigInt/t/dparts-mbi.t deleted file mode 100644 index 0b4ba38267..0000000000 --- a/cpan/Math-BigInt/t/dparts-mbi.t +++ /dev/null @@ -1,162 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 784; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $int_str, $frc_str) = split /:/; - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| (\$i, \$f) = \$x -> dparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my ($int_got, $frc_got) = $x -> dparts(); - - isa_ok($int_got, "Math::BigInt"); - isa_ok($frc_got, "Math::BigInt"); - - is($int_got, $int_str, "value of integer part"); - is($frc_got, $frc_str, "value of fraction part"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| \$i = \$x -> dparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my $int_got = $x -> dparts(); - - isa_ok($int_got, "Math::BigInt"); - - is($int_got, $int_str, "value of integer part"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:0 - -inf:inf:0 --inf:-inf:0 - -0:0:0 - -# positive numbers - -1:1:0 -10:10:0 -100:100:0 -1000:1000:0 -10000:10000:0 -100000:100000:0 -1000000:1000000:0 -10000000:10000000:0 -100000000:100000000:0 -1000000000:1000000000:0 -10000000000:10000000000:0 -100000000000:100000000000:0 -1000000000000:1000000000000:0 - -12:12:0 -120:120:0 -1200:1200:0 -12000:12000:0 -120000:120000:0 -1200000:1200000:0 -12000000:12000000:0 -120000000:120000000:0 -1200000000:1200000000:0 -12000000000:12000000000:0 -120000000000:120000000000:0 -1200000000000:1200000000000:0 - -123:123:0 -1230:1230:0 -12300:12300:0 -123000:123000:0 -1230000:1230000:0 -12300000:12300000:0 -123000000:123000000:0 -1230000000:1230000000:0 -12300000000:12300000000:0 -123000000000:123000000000:0 -1230000000000:1230000000000:0 - -1234:1234:0 -12340:12340:0 -123400:123400:0 -1234000:1234000:0 -12340000:12340000:0 -123400000:123400000:0 -1234000000:1234000000:0 -12340000000:12340000000:0 -123400000000:123400000000:0 -1234000000000:1234000000000:0 - -3141592:3141592:0 - -# negative numbers - --1:-1:0 --10:-10:0 --100:-100:0 --1000:-1000:0 --10000:-10000:0 --100000:-100000:0 --1000000:-1000000:0 --10000000:-10000000:0 --100000000:-100000000:0 --1000000000:-1000000000:0 --10000000000:-10000000000:0 --100000000000:-100000000000:0 --1000000000000:-1000000000000:0 - --12:-12:0 --120:-120:0 --1200:-1200:0 --12000:-12000:0 --120000:-120000:0 --1200000:-1200000:0 --12000000:-12000000:0 --120000000:-120000000:0 --1200000000:-1200000000:0 --12000000000:-12000000000:0 --120000000000:-120000000000:0 --1200000000000:-1200000000000:0 - --123:-123:0 --1230:-1230:0 --12300:-12300:0 --123000:-123000:0 --1230000:-1230000:0 --12300000:-12300000:0 --123000000:-123000000:0 --1230000000:-1230000000:0 --12300000000:-12300000000:0 --123000000000:-123000000000:0 --1230000000000:-1230000000000:0 - --1234:-1234:0 --12340:-12340:0 --123400:-123400:0 --1234000:-1234000:0 --12340000:-12340000:0 --123400000:-123400000:0 --1234000000:-1234000000:0 --12340000000:-12340000000:0 --123400000000:-123400000000:0 --1234000000000:-1234000000000:0 - --3141592:-3141592:0 diff --git a/cpan/Math-BigInt/t/eparts-mbf.t b/cpan/Math-BigInt/t/eparts-mbf.t deleted file mode 100644 index a612461fa9..0000000000 --- a/cpan/Math-BigInt/t/eparts-mbf.t +++ /dev/null @@ -1,294 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1840; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> eparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my ($mant_got, $expo_got) = $x -> eparts(); - - isa_ok($mant_got, "Math::BigFloat"); - isa_ok($expo_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| \$m = \$x -> eparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my $mant_got = $x -> eparts(); - - isa_ok($mant_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -0.000000000001:1:-12 -0.00000000001:10:-12 -0.0000000001:100:-12 -0.000000001:1:-9 -0.00000001:10:-9 -0.0000001:100:-9 -0.000001:1:-6 -0.00001:10:-6 -0.0001:100:-6 -0.001:1:-3 -0.01:10:-3 -0.1:100:-3 -1:1:0 -10:10:0 -100:100:0 -1000:1:3 -10000:10:3 -100000:100:3 -1000000:1:6 -10000000:10:6 -100000000:100:6 -1000000000:1:9 -10000000000:10:9 -100000000000:100:9 -1000000000000:1:12 - -0.0000000000012:1.2:-12 -0.000000000012:12:-12 -0.00000000012:120:-12 -0.0000000012:1.2:-9 -0.000000012:12:-9 -0.00000012:120:-9 -0.0000012:1.2:-6 -0.000012:12:-6 -0.00012:120:-6 -0.0012:1.2:-3 -0.012:12:-3 -0.12:120:-3 -1.2:1.2:0 -12:12:0 -120:120:0 -1200:1.2:3 -12000:12:3 -120000:120:3 -1200000:1.2:6 -12000000:12:6 -120000000:120:6 -1200000000:1.2:9 -12000000000:12:9 -120000000000:120:9 -1200000000000:1.2:12 - -0.00000000000123:1.23:-12 -0.0000000000123:12.3:-12 -0.000000000123:123:-12 -0.00000000123:1.23:-9 -0.0000000123:12.3:-9 -0.000000123:123:-9 -0.00000123:1.23:-6 -0.0000123:12.3:-6 -0.000123:123:-6 -0.00123:1.23:-3 -0.0123:12.3:-3 -0.123:123:-3 -1.23:1.23:0 -12.3:12.3:0 -123:123:0 -1230:1.23:3 -12300:12.3:3 -123000:123:3 -1230000:1.23:6 -12300000:12.3:6 -123000000:123:6 -1230000000:1.23:9 -12300000000:12.3:9 -123000000000:123:9 -1230000000000:1.23:12 - -0.000000000001234:1.234:-12 -0.00000000001234:12.34:-12 -0.0000000001234:123.4:-12 -0.000000001234:1.234:-9 -0.00000001234:12.34:-9 -0.0000001234:123.4:-9 -0.000001234:1.234:-6 -0.00001234:12.34:-6 -0.0001234:123.4:-6 -0.001234:1.234:-3 -0.01234:12.34:-3 -0.1234:123.4:-3 -1.234:1.234:0 -12.34:12.34:0 -123.4:123.4:0 -1234:1.234:3 -12340:12.34:3 -123400:123.4:3 -1234000:1.234:6 -12340000:12.34:6 -123400000:123.4:6 -1234000000:1.234:9 -12340000000:12.34:9 -123400000000:123.4:9 -1234000000000:1.234:12 - -0.000003141592:3.141592:-6 -0.00003141592:31.41592:-6 -0.0003141592:314.1592:-6 -0.003141592:3.141592:-3 -0.03141592:31.41592:-3 -0.3141592:314.1592:-3 -3.141592:3.141592:0 -31.41592:31.41592:0 -314.1592:314.1592:0 -3141.592:3.141592:3 -31415.92:31.41592:3 -314159.2:314.1592:3 -3141592:3.141592:6 - -# negativ: numbers - --0.000000000001:-1:-12 --0.00000000001:-10:-12 --0.0000000001:-100:-12 --0.000000001:-1:-9 --0.00000001:-10:-9 --0.0000001:-100:-9 --0.000001:-1:-6 --0.00001:-10:-6 --0.0001:-100:-6 --0.001:-1:-3 --0.01:-10:-3 --0.1:-100:-3 --1:-1:0 --10:-10:0 --100:-100:0 --1000:-1:3 --10000:-10:3 --100000:-100:3 --1000000:-1:6 --10000000:-10:6 --100000000:-100:6 --1000000000:-1:9 --10000000000:-10:9 --100000000000:-100:9 --1000000000000:-1:12 - --0.0000000000012:-1.2:-12 --0.000000000012:-12:-12 --0.00000000012:-120:-12 --0.0000000012:-1.2:-9 --0.000000012:-12:-9 --0.00000012:-120:-9 --0.0000012:-1.2:-6 --0.000012:-12:-6 --0.00012:-120:-6 --0.0012:-1.2:-3 --0.012:-12:-3 --0.12:-120:-3 --1.2:-1.2:0 --12:-12:0 --120:-120:0 --1200:-1.2:3 --12000:-12:3 --120000:-120:3 --1200000:-1.2:6 --12000000:-12:6 --120000000:-120:6 --1200000000:-1.2:9 --12000000000:-12:9 --120000000000:-120:9 --1200000000000:-1.2:12 - --0.00000000000123:-1.23:-12 --0.0000000000123:-12.3:-12 --0.000000000123:-123:-12 --0.00000000123:-1.23:-9 --0.0000000123:-12.3:-9 --0.000000123:-123:-9 --0.00000123:-1.23:-6 --0.0000123:-12.3:-6 --0.000123:-123:-6 --0.00123:-1.23:-3 --0.0123:-12.3:-3 --0.123:-123:-3 --1.23:-1.23:0 --12.3:-12.3:0 --123:-123:0 --1230:-1.23:3 --12300:-12.3:3 --123000:-123:3 --1230000:-1.23:6 --12300000:-12.3:6 --123000000:-123:6 --1230000000:-1.23:9 --12300000000:-12.3:9 --123000000000:-123:9 --1230000000000:-1.23:12 - --0.000000000001234:-1.234:-12 --0.00000000001234:-12.34:-12 --0.0000000001234:-123.4:-12 --0.000000001234:-1.234:-9 --0.00000001234:-12.34:-9 --0.0000001234:-123.4:-9 --0.000001234:-1.234:-6 --0.00001234:-12.34:-6 --0.0001234:-123.4:-6 --0.001234:-1.234:-3 --0.01234:-12.34:-3 --0.1234:-123.4:-3 --1.234:-1.234:0 --12.34:-12.34:0 --123.4:-123.4:0 --1234:-1.234:3 --12340:-12.34:3 --123400:-123.4:3 --1234000:-1.234:6 --12340000:-12.34:6 --123400000:-123.4:6 --1234000000:-1.234:9 --12340000000:-12.34:9 --123400000000:-123.4:9 --1234000000000:-1.234:12 - --0.000003141592:-3.141592:-6 --0.00003141592:-31.41592:-6 --0.0003141592:-314.1592:-6 --0.003141592:-3.141592:-3 --0.03141592:-31.41592:-3 --0.3141592:-314.1592:-3 --3.141592:-3.141592:0 --31.41592:-31.41592:0 --314.1592:-314.1592:0 --3141.592:-3.141592:3 --31415.92:-31.41592:3 --314159.2:-314.1592:3 --3141592:-3.141592:6 diff --git a/cpan/Math-BigInt/t/eparts-mbi.t b/cpan/Math-BigInt/t/eparts-mbi.t deleted file mode 100644 index 783f716e5c..0000000000 --- a/cpan/Math-BigInt/t/eparts-mbi.t +++ /dev/null @@ -1,162 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 784; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> eparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my ($mant_got, $expo_got) = $x -> eparts(); - - isa_ok($mant_got, "Math::BigInt"); - isa_ok($expo_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| \$m = \$x -> eparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my $mant_got = $x -> eparts(); - - isa_ok($mant_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -1:1:0 -10:10:0 -100:100:0 -1000:1:3 -10000:10:3 -100000:100:3 -1000000:1:6 -10000000:10:6 -100000000:100:6 -1000000000:1:9 -10000000000:10:9 -100000000000:100:9 -1000000000000:1:12 - -12:12:0 -120:120:0 -1200:NaN:3 -12000:12:3 -120000:120:3 -1200000:NaN:6 -12000000:12:6 -120000000:120:6 -1200000000:NaN:9 -12000000000:12:9 -120000000000:120:9 -1200000000000:NaN:12 - -123:123:0 -1230:NaN:3 -12300:NaN:3 -123000:123:3 -1230000:NaN:6 -12300000:NaN:6 -123000000:123:6 -1230000000:NaN:9 -12300000000:NaN:9 -123000000000:123:9 -1230000000000:NaN:12 - -1234:NaN:3 -12340:NaN:3 -123400:NaN:3 -1234000:NaN:6 -12340000:NaN:6 -123400000:NaN:6 -1234000000:NaN:9 -12340000000:NaN:9 -123400000000:NaN:9 -1234000000000:NaN:12 - -3141592:NaN:6 - -# negativ: numbers - --1:-1:0 --10:-10:0 --100:-100:0 --1000:-1:3 --10000:-10:3 --100000:-100:3 --1000000:-1:6 --10000000:-10:6 --100000000:-100:6 --1000000000:-1:9 --10000000000:-10:9 --100000000000:-100:9 --1000000000000:-1:12 - --12:-12:0 --120:-120:0 --1200:NaN:3 --12000:-12:3 --120000:-120:3 --1200000:NaN:6 --12000000:-12:6 --120000000:-120:6 --1200000000:NaN:9 --12000000000:-12:9 --120000000000:-120:9 --1200000000000:NaN:12 - --123:-123:0 --1230:NaN:3 --12300:NaN:3 --123000:-123:3 --1230000:NaN:6 --12300000:NaN:6 --123000000:-123:6 --1230000000:NaN:9 --12300000000:NaN:9 --123000000000:-123:9 --1230000000000:NaN:12 - --1234:NaN:3 --12340:NaN:3 --123400:NaN:3 --1234000:NaN:6 --12340000:NaN:6 --123400000:NaN:6 --1234000000:NaN:9 --12340000000:NaN:9 --123400000000:NaN:9 --1234000000000:NaN:12 - --3141592:NaN:6 diff --git a/cpan/Math-BigInt/t/fparts-mbf.t b/cpan/Math-BigInt/t/fparts-mbf.t deleted file mode 100644 index 8d555bde9c..0000000000 --- a/cpan/Math-BigInt/t/fparts-mbf.t +++ /dev/null @@ -1,97 +0,0 @@ -# -*- mode: perl; -*- - -# test fparts(), numerator(), denominator() - -use strict; -use warnings; - -use Test::More tests => 43; - -my $class; - -BEGIN { - $class = 'Math::BigFloat'; - use_ok($class); -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $n_str, $d_str) = split /:/; - my $test; - - # test fparts() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| (\$n, \$d) = \$x -> fparts();|; - - subtest $test => sub { - plan tests => 5; - - my $x = $class -> new($x_str); - my ($n, $d) = $x -> fparts(); - - is(ref($n), $class, "class of numerator"); - is(ref($d), $class, "class of denominator"); - - is($n, $n_str, "value of numerator"); - is($d, $d_str, "value of denominator"); - is($x, $x_str, "input is unmodified"); - }; - - # test numerator() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| \$n = \$x -> numerator();|; - - subtest $test => sub { - plan tests => 3; - - my $x = $class -> new($x_str); - my $n = $x -> numerator(); - - is(ref($n), $class, "class of numerator"); - - is($n, $n_str, "value of numerator"); - is($x, $x_str, "input is unmodified"); - }; - - # test denominator() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| \$d = \$x -> denominator();|; - - subtest $test => sub { - plan tests => 3; - - my $x = $class -> new($x_str); - my $d = $x -> denominator(); - - is(ref($d), $class, "class of denominator"); - - is($d, $d_str, "value of denominator"); - is($x, $x_str, "input is unmodified"); - }; -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:1 --inf:-inf:1 - --30:-30:1 --3:-3:1 --1:-1:1 -0:0:1 -1:1:1 -3:3:1 -30:30:1 - --31400:-31400:1 --3.14:-157:50 -3.14:157:50 -31400:31400:1 diff --git a/cpan/Math-BigInt/t/fparts-mbi.t b/cpan/Math-BigInt/t/fparts-mbi.t deleted file mode 100644 index 449d6d8a59..0000000000 --- a/cpan/Math-BigInt/t/fparts-mbi.t +++ /dev/null @@ -1,92 +0,0 @@ -# -*- mode: perl; -*- - -# test fparts(), numerator(), denominator() - -use strict; -use warnings; - -use Test::More tests => 31; - -my $class; - -BEGIN { - $class = 'Math::BigInt'; - use_ok($class); -} - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $n_str, $d_str) = split /:/; - my $test; - - # test fparts() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| (\$n, \$d) = \$x -> fparts();|; - - subtest $test => sub { - plan tests => 5; - - my $x = $class -> new($x_str); - my ($n, $d) = $x -> fparts(); - - is(ref($n), $class, "class of numerator"); - is(ref($d), $class, "class of denominator"); - - is($n, $n_str, "value of numerator"); - is($d, $d_str, "value of denominator"); - is($x, $x_str, "input is unmodified"); - }; - - # test numerator() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| \$n = \$x -> numerator();|; - - subtest $test => sub { - plan tests => 3; - - my $x = $class -> new($x_str); - my $n = $x -> numerator(); - - is(ref($n), $class, "class of numerator"); - - is($n, $n_str, "value of numerator"); - is($x, $x_str, "input is unmodified"); - }; - - # test denominator() - - $test = qq|\$x = $class -> new("$x_str");| - . qq| \$d = \$x -> denominator();|; - - subtest $test => sub { - plan tests => 3; - - my $x = $class -> new($x_str); - my $d = $x -> denominator(); - - is(ref($d), $class, "class of denominator"); - - is($d, $d_str, "value of denominator"); - is($x, $x_str, "input is unmodified"); - }; -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:1 --inf:-inf:1 - --30:-30:1 --3:-3:1 --1:-1:1 -0:0:1 -1:1:1 -3:3:1 -30:30:1 diff --git a/cpan/Math-BigInt/t/from_base-mbi.t b/cpan/Math-BigInt/t/from_base-mbi.t deleted file mode 100644 index 1f664e1652..0000000000 --- a/cpan/Math-BigInt/t/from_base-mbi.t +++ /dev/null @@ -1,126 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 176; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -my @data; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my @in = split /:/; - my $out = pop @in; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_base("$in[0]", $in[1]|; - $test .= qq|, "$in[2]"| if @in == 3; - $test .= qq|);|; - - eval $test; - #die $@ if $@; # this should never happen - die "\nThe following test died when eval()'ed. This indicates a ", - "broken test\n\n $test\n\nThe error message was\n\n $@\n" - if $@; - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");|; - $test .= qq| \$x -> from_base("$in[0]", $in[1]|; - $test .= qq|, "$in[2]"| if @in == 3; - $test .= qq|);|; - - eval $test; - #die $@ if $@; # this should never happen - die "\nThe following test died when eval()'ed. This indicates a ", - "broken test\n\n $test\n\nThe error message was\n\n $@\n" - if $@; - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out, 'output arg has the right value'); - }; - } - } -} - -__END__ - -# Base 2 - -11111010:2:250 -11111010:2:01:250 - -# Base 8 - -372:8:250 -372:8:01234567:250 - -# Base 10 (in the last case, use a truncted collation sequence that does not -# include unused characters) - -250:10:250 -250:10:0123456789:250 -250:10:012345:250 - -# Base 16 - -fa:16:250 -FA:16:250 -fa:16:0123456789abcdef:250 - -# Base 3 - -100021:3:250 -100021:3:012:250 - -/|-:3:-/|:15 - -# Base 4 - -3322:4:250 -3322:4:0123:250 - -# Base 5 - -2000:5:250 -2000:5:01234:250 -caaa:5:abcde:250 - -# when base is less than or equal to 36, case is ignored - -6Y:36:250 -6y:36:250 - -6S:37:250 -7H:37:276 - -121:3:16 - -XYZ:36:44027 - -Why:62:125734 diff --git a/cpan/Math-BigInt/t/from_base_num-mbi.t b/cpan/Math-BigInt/t/from_base_num-mbi.t deleted file mode 100644 index aad7c6d18b..0000000000 --- a/cpan/Math-BigInt/t/from_base_num-mbi.t +++ /dev/null @@ -1,119 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 365; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -# For simplicity, we use the same data in the test programs for to_base_num() and -# from_base_num(). - -my @data = - ( - [ 0, 2, [ 0 ] ], - [ 1, 2, [ 1 ] ], - [ 2, 2, [ 1, 0 ] ], - [ 3, 2, [ 1, 1, ] ], - [ 4, 2, [ 1, 0, 0 ] ], - - [ 0, 10, [ 0 ] ], - [ 1, 10, [ 1 ] ], - [ 12, 10, [ 1, 2 ] ], - [ 123, 10, [ 1, 2, 3 ] ], - [ 1230, 10, [ 1, 2, 3, 0 ] ], - - [ "123456789", 100, [ 1, 23, 45, 67, 89 ] ], - - [ "1234567890" x 3, - "987654321", - [ "128", "142745769", "763888804", "574845669" ]], - - [ "1234567890" x 5, - "987654321" x 3, - [ "12499999874843750102814", "447551941015330718793208596" ]], - ); - -for (my $i = 0 ; $i <= $#data ; ++ $i) { - my @in = ($data[$i][2], $data[$i][1]); - my $out = $data[$i][0]; - - # As class method. - - { - for my $base_as_scalar (1, 0) { - for my $elements_as_scalar (1, 0) { - - my $x; - my $test = "\$x = $class -> from_base_num(["; - if ($elements_as_scalar) { - $test .= join ", ", map qq|"$_"|, @{ $in[0] }; - } else { - $test .= join ", ", map qq|$class -> new("$_")|, @{ $in[0] }; - } - $test .= "], "; - if ($base_as_scalar) { - $test .= qq|"$in[1]"|; - } else { - $test .= qq|$class -> new("$in[1]")|; - } - $test .= ")"; - - eval $test; - die "\nThe following test died when eval()'ed. This", - "indicates a broken test\n\n $test\n\nThe error", - " message was\n\n $@\n" if $@; - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out, 'output arg has the right value'); - }; - } - } - } - - # As instance method. - - { - for my $base_as_scalar (1, 0) { - for my $elements_as_scalar (1, 0) { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - - my $x; - my $test = qq|\$x = $class -> new("$str");|; - $test .= " \$x -> from_base_num(["; - if ($elements_as_scalar) { - $test .= join ", ", map qq|"$_"|, @{ $in[0] }; - } else { - $test .= join ", ", map qq|$class -> new("$_")|, @{ $in[0] }; - } - $test .= "], "; - if ($base_as_scalar) { - $test .= qq|"$in[1]"|; - } else { - $test .= qq|$class -> new("$in[1]")|; - } - $test .= ")"; - - eval $test; - die "\nThe following test died when eval()'ed. This", - "indicates a broken test\n\n $test\n\nThe error", - " message was\n\n $@\n" if $@; - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out, 'output arg has the right value'); - }; - } - } - } - } -} diff --git a/cpan/Math-BigInt/t/from_bin-mbf.t b/cpan/Math-BigInt/t/from_bin-mbf.t deleted file mode 100644 index a24f1bfd4d..0000000000 --- a/cpan/Math-BigInt/t/from_bin-mbf.t +++ /dev/null @@ -1,105 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 785; - -my $class; - -BEGIN { $class = 'Math::BigFloat'; } -BEGIN { use_ok($class, '1.999710'); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_bin("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_bin("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -0b1p+0:1 -0b.1p+1:1 -0b.01p+2:1 -0b.001p+3:1 -0b.0001p+4:1 -0b10p-1:1 -0b100p-2:1 -0b1000p-3:1 - --0b1p+0:-1 - -0b0p+0:0 -0b0p+7:0 -0b0p-7:0 -0b0.p+0:0 -0b.0p+0:0 -0b0.0p+0:0 - -0b1100101011111110:51966 -0B1100101011111110:51966 -b1100101011111110:51966 -B1100101011111110:51966 -1100101011111110:51966 - -0b1.1001p+3:12.5 -0b10010.001101p-1:9.1015625 --0b.11110001001101010111100110111101111p+31:-2023406814.9375 -0b10.0100011010001010110011110001001101p+34:39093746765 - -0b.p+0:NaN - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/from_bin-mbi.t b/cpan/Math-BigInt/t/from_bin-mbi.t deleted file mode 100644 index da8300726b..0000000000 --- a/cpan/Math-BigInt/t/from_bin-mbi.t +++ /dev/null @@ -1,132 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1457; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_bin("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_bin("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -0b0:0 -0b1:1 -0b10:2 -0b11:3 -0b100:4 -0b101:5 -0b110:6 -0b111:7 -0b1000:8 -0b1001:9 -0b1010:10 -0b1011:11 -0b1100:12 -0b1101:13 -0b1110:14 -0b1111:15 -0b10000:16 -0b10001:17 - -0b11111110:254 -0b11111111:255 -0b100000000:256 -0b100000001:257 - -0b1111111111111110:65534 -0b1111111111111111:65535 -0b10000000000000000:65536 -0b10000000000000001:65537 - -0b111111111111111111111110:16777214 -0b111111111111111111111111:16777215 -0b1000000000000000000000000:16777216 -0b1000000000000000000000001:16777217 - -0b11111111111111111111111111111110:4294967294 -0b11111111111111111111111111111111:4294967295 -0b100000000000000000000000000000000:4294967296 -0b100000000000000000000000000000001:4294967297 - -0b1111111111111111111111111111111111111110:1099511627774 -0b1111111111111111111111111111111111111111:1099511627775 -0b10000000000000000000000000000000000000000:1099511627776 -0b10000000000000000000000000000000000000001:1099511627777 - -0b111111111111111111111111111111111111111111111110:281474976710654 -0b111111111111111111111111111111111111111111111111:281474976710655 -0b1000000000000000000000000000000000000000000000000:281474976710656 -0b1000000000000000000000000000000000000000000000001:281474976710657 - -0b11111111111111111111111111111111111111111111111111111110:72057594037927934 -0b11111111111111111111111111111111111111111111111111111111:72057594037927935 -0b100000000000000000000000000000000000000000000000000000000:72057594037927936 -0b100000000000000000000000000000000000000000000000000000001:72057594037927937 - -0B10:2 -b10:2 -B10:2 - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/from_hex-mbf.t b/cpan/Math-BigInt/t/from_hex-mbf.t deleted file mode 100644 index 8a9f3cf012..0000000000 --- a/cpan/Math-BigInt/t/from_hex-mbf.t +++ /dev/null @@ -1,105 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 785; - -my $class; - -BEGIN { $class = 'Math::BigFloat'; } -BEGIN { use_ok($class, '1.999821'); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_hex("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_hex("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -0x1p+0:1 -0x.8p+1:1 -0x.4p+2:1 -0x.2p+3:1 -0x.1p+4:1 -0x2p-1:1 -0x4p-2:1 -0x8p-3:1 - --0x1p+0:-1 - -0x0p+0:0 -0x0p+7:0 -0x0p-7:0 -0x0.p+0:0 -0x.0p+0:0 -0x0.0p+0:0 - -0xcafe:51966 -0Xcafe:51966 -xcafe:51966 -Xcafe:51966 -cafe:51966 - -0x1.9p+3:12.5 -0x12.34p-1:9.1015625 --0x.789abcdefp+32:-2023406814.9375 -0x12.3456789ap+31:39093746765 - -0x.p+0:NaN - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/from_hex-mbi.t b/cpan/Math-BigInt/t/from_hex-mbi.t deleted file mode 100644 index 200253134f..0000000000 --- a/cpan/Math-BigInt/t/from_hex-mbi.t +++ /dev/null @@ -1,132 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1457; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_hex("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_hex("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -0x0:0 -0x1:1 -0x2:2 -0x3:3 -0x4:4 -0x5:5 -0x6:6 -0x7:7 -0x8:8 -0x9:9 -0xa:10 -0xb:11 -0xc:12 -0xd:13 -0xe:14 -0xf:15 -0x10:16 -0x11:17 - -0xfe:254 -0xff:255 -0x100:256 -0x101:257 - -0xfffe:65534 -0xffff:65535 -0x10000:65536 -0x10001:65537 - -0xfffffe:16777214 -0xffffff:16777215 -0x1000000:16777216 -0x1000001:16777217 - -0xfffffffe:4294967294 -0xffffffff:4294967295 -0x100000000:4294967296 -0x100000001:4294967297 - -0xfffffffffe:1099511627774 -0xffffffffff:1099511627775 -0x10000000000:1099511627776 -0x10000000001:1099511627777 - -0xfffffffffffe:281474976710654 -0xffffffffffff:281474976710655 -0x1000000000000:281474976710656 -0x1000000000001:281474976710657 - -0xfffffffffffffe:72057594037927934 -0xffffffffffffff:72057594037927935 -0x100000000000000:72057594037927936 -0x100000000000001:72057594037927937 - -0X10:16 -x10:16 -X10:16 - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/from_ieee754-mbf.t b/cpan/Math-BigInt/t/from_ieee754-mbf.t deleted file mode 100644 index 8edb904ba4..0000000000 --- a/cpan/Math-BigInt/t/from_ieee754-mbf.t +++ /dev/null @@ -1,257 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 230; - -use Math::BigFloat; - -my @k = (16, 32, 64, 128); - -sub stringify { - my $x = shift; - return "$x" unless $x -> is_finite(); - my $nstr = $x -> bnstr(); - my $sstr = $x -> bsstr(); - return length($nstr) < length($sstr) ? $nstr : $sstr; -} - -for my $k (@k) { - - # Parameters specific to this format: - - my $b = 2; - my $p = $k == 16 ? 11 - : $k == 32 ? 24 - : $k == 64 ? 53 - : $k - sprintf("%.0f", 4 * log($k)/log(2)) + 13; - - $b = Math::BigFloat -> new($b); - $k = Math::BigFloat -> new($k); - $p = Math::BigFloat -> new($p); - my $w = $k - $p; - - my $emax = 2 ** ($w - 1) - 1; - my $emin = 1 - $emax; - - my $format = sprintf 'binary%u', $k; - - my $binv = Math::BigFloat -> new("0.5"); - - my $data = - [ - - { - dsc => "smallest positive subnormal number", - bin => "0" - . ("0" x $w) - . ("0" x ($p - 2)) . "1", - asc => "$b ** ($emin) * $b ** (" . (1 - $p) . ") " - . "= $b ** (" . ($emin + 1 - $p) . ")", - mbf => $binv ** ($p - 1 - $emin), - }, - - { - dsc => "largest subnormal number", - bin => "0" - . ("0" x $w) - . ("1" x ($p - 1)), - asc => "$b ** ($emin) * (1 - $b ** (" . (1 - $p) . "))", - mbf => $binv ** (-$emin) * (1 - $binv ** ($p - 1)), - }, - - { - dsc => "smallest positive normal number", - bin => "0" - . ("0" x ($w - 1)) . "1" - . ("0" x ($p - 1)), - asc => "$b ** ($emin)", - mbf => $binv ** (-$emin), - }, - - { - dsc => "largest normal number", - bin => "0" - . ("1" x ($w - 1)) . "0" - . "1" x ($p - 1), - asc => "$b ** $emax * ($b - $b ** (" . (1 - $p) . "))", - mbf => $b ** $emax * ($b - $binv ** ($p - 1)), - }, - - { - dsc => "largest number less than one", - bin => "0" - . "0" . ("1" x ($w - 2)) . "0" - . "1" x ($p - 1), - asc => "1 - $b ** (-$p)", - mbf => 1 - $binv ** $p, - }, - - { - dsc => "smallest number larger than one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . ("0" x ($p - 2)) . "1", - asc => "1 + $b ** (" . (1 - $p) . ")", - mbf => 1 + $binv ** ($p - 1), - }, - - { - dsc => "second smallest number larger than one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . ("0" x ($p - 3)) . "10", - asc => "1 + $b ** (" . (2 - $p) . ")", - mbf => 1 + $binv ** ($p - 2), - }, - - { - dsc => "one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . "0" x ($p - 1), - asc => "1", - mbf => Math::BigFloat -> new("1"), - }, - - { - dsc => "minus one", - bin => "1" - . "0" . ("1" x ($w - 1)) - . "0" x ($p - 1), - asc => "-1", - mbf => Math::BigFloat -> new("-1"), - }, - - { - dsc => "two", - bin => "0" - . "1" . ("0" x ($w - 1)) - . ("0" x ($p - 1)), - asc => "2", - mbf => Math::BigFloat -> new("2"), - }, - - { - dsc => "minus two", - bin => "1" - . "1" . ("0" x ($w - 1)) - . ("0" x ($p - 1)), - asc => "-2", - mbf => Math::BigFloat -> new("-2"), - }, - - { - dsc => "positive zero", - bin => "0" - . ("0" x $w) - . ("0" x ($p - 1)), - asc => "+0", - mbf => Math::BigFloat -> new("0"), - }, - - { - dsc => "negative zero", - bin => "1" - . ("0" x $w) - . ("0" x ($p - 1)), - asc => "-0", - mbf => Math::BigFloat -> new("0"), - }, - - { - dsc => "positive infinity", - bin => "0" - . ("1" x $w) - . ("0" x ($p - 1)), - asc => "+inf", - mbf => Math::BigFloat -> new("inf"), - }, - - { - dsc => "negative infinity", - bin => "1" - . ("1" x $w) - . ("0" x ($p - 1)), - asc => "-inf", - mbf => Math::BigFloat -> new("-inf"), - }, - - { - dsc => "NaN (sNaN on most processors, such as x86 and ARM)", - bin => "0" - . ("1" x $w) - . ("0" x ($p - 2)) . "1", - asc => "sNaN", - mbf => Math::BigFloat -> new("NaN"), - }, - - { - dsc => "NaN (qNaN on most processors, such as x86 and ARM)", - bin => "0" - . ("1" x $w) - . "1" . ("0" x ($p - 3)) . "1", - asc => "qNaN", - mbf => Math::BigFloat -> new("NaN"), - }, - - { - dsc => "NaN (an alternative encoding)", - bin => "0" - . ("1" x $w) - . ("1" x ($p - 1)), - asc => "NaN", - mbf => Math::BigFloat -> new("NaN"), - }, - - { - dsc => "NaN (encoding used by Perl on Cygwin)", - bin => "1" - . ("1" x $w) - . ("1" . ("0" x ($p - 2))), - asc => "NaN", - mbf => Math::BigFloat -> new("NaN"), - }, - - ]; - - for my $entry (@$data) { - my $bin = $entry -> {bin}; - my $bytes = pack "B*", $bin; - my $hex = unpack "H*", $bytes; - - note("\n", $entry -> {dsc }, " (k = $k)\n\n"); - - my $expected = stringify($entry -> {mbf}); - my ($got, $test); - - $got = Math::BigFloat -> from_ieee754($bin, $format); - $got = stringify($got); - $test = qq|Math::BigFloat->from_ieee754("$bin")|; - is($got, $expected, $test); - - $got = Math::BigFloat -> from_ieee754($hex, $format); - $got = stringify($got); - $test = qq|Math::BigFloat->from_ieee754("$hex")|; - is($got, $expected, $test); - - $got = Math::BigFloat -> from_ieee754($bytes, $format); - $got = stringify($got); - (my $str = $hex) =~ s/(..)/\\x$1/g; - $test = qq|Math::BigFloat->from_ieee754("$str")|; - is($got, $expected, $test); - } -} - -note("\nTest as class method vs. instance method.\n\n"); - -# As class method. - -my $x = Math::BigFloat -> from_ieee754("4000000000000000", "binary64"); -is($x, 2, "class method"); - -# As instance method, the invocand should be modified. - -$x -> from_ieee754("4008000000000000", "binary64"); -is($x, 3, "instance method modifies invocand"); diff --git a/cpan/Math-BigInt/t/from_oct-mbf.t b/cpan/Math-BigInt/t/from_oct-mbf.t deleted file mode 100644 index 2fff2a0ba3..0000000000 --- a/cpan/Math-BigInt/t/from_oct-mbf.t +++ /dev/null @@ -1,137 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1401; - -my $class; - -BEGIN { $class = 'Math::BigFloat'; } -BEGIN { use_ok($class, '1.999710'); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_oct("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_oct("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -# Without "0o" prefix. - -01p+0:1 -0.4p+1:1 -0.2p+2:1 -0.1p+3:1 -0.04p+4:1 -02p-1:1 -04p-2:1 -010p-3:1 - --1p+0:-1 - -0p+0:0 -0p+7:0 -0p-7:0 -0.p+0:0 -.0p+0:0 -0.0p+0:0 - -145376:51966 -0145376:51966 -00145376:51966 - -3.1p+2:12.5 -22.15p-1:9.1015625 --0.361152746757p+32:-2023406814.9375 -44.3212636115p+30:39093746765 - -.p+0:NaN - -# With "0o" prefix. - -0o01p+0:1 -0o0.4p+1:1 -0o0.2p+2:1 -0o0.1p+3:1 -0o0.04p+4:1 -0o02p-1:1 -0o04p-2:1 -0o010p-3:1 - --0o1p+0:-1 - -0o0p+0:0 -0o0p+7:0 -0o0p-7:0 -0o0.p+0:0 -0o.0p+0:0 -0o0.0p+0:0 - -0o145376:51966 -0O145376:51966 -o145376:51966 -O145376:51966 - -0o3.1p+2:12.5 -0o22.15p-1:9.1015625 --0o0.361152746757p+32:-2023406814.9375 -0o44.3212636115p+30:39093746765 - -0o.p+0:NaN - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/from_oct-mbi.t b/cpan/Math-BigInt/t/from_oct-mbi.t deleted file mode 100644 index 3ec700ee88..0000000000 --- a/cpan/Math-BigInt/t/from_oct-mbi.t +++ /dev/null @@ -1,186 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 2745; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -my @data; -my $space = "\t\r\n "; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - - push @data, [ $in0, $out0 ], - [ $in0 . $space, $out0 ], - [ $space . $in0, $out0 ], - [ $space . $in0 . $space, $out0 ]; -} - -for my $entry (@data) { - my ($in0, $out0) = @$entry; - - # As class method. - - { - my $x; - my $test = qq|\$x = $class -> from_oct("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - - # As instance method. - - { - for my $str ("-1", "0", "1", "-inf", "+inf", "NaN") { - my $x; - my $test = qq|\$x = $class -> new("$str");| - . qq| \$x -> from_oct("$in0");|; - - eval $test; - die $@ if $@; # this should never happen - - subtest $test, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - } - } -} - -__END__ - -0:0 -1:1 -2:2 -3:3 -4:4 -5:5 -6:6 -7:7 -10:8 -11:9 -12:10 -13:11 -14:12 -15:13 -16:14 -17:15 -20:16 -21:17 - -376:254 -377:255 -400:256 -401:257 - -177776:65534 -177777:65535 -200000:65536 -200001:65537 - -77777776:16777214 -77777777:16777215 -100000000:16777216 -100000001:16777217 - -37777777776:4294967294 -37777777777:4294967295 -40000000000:4294967296 -40000000001:4294967297 - -17777777777776:1099511627774 -17777777777777:1099511627775 -20000000000000:1099511627776 -20000000000001:1099511627777 - -7777777777777776:281474976710654 -7777777777777777:281474976710655 -10000000000000000:281474976710656 -10000000000000001:281474976710657 - -3777777777777777776:72057594037927934 -3777777777777777777:72057594037927935 -4000000000000000000:72057594037927936 -4000000000000000001:72057594037927937 - -0o0:0 -0o1:1 -0o2:2 -0o3:3 -0o4:4 -0o5:5 -0o6:6 -0o7:7 -0o10:8 -0o11:9 -0o12:10 -0o13:11 -0o14:12 -0o15:13 -0o16:14 -0o17:15 -0o20:16 -0o21:17 - -0o376:254 -0o377:255 -0o400:256 -0o401:257 - -0o177776:65534 -0o177777:65535 -0o200000:65536 -0o200001:65537 - -0o77777776:16777214 -0o77777777:16777215 -0o100000000:16777216 -0o100000001:16777217 - -0o37777777776:4294967294 -0o37777777777:4294967295 -0o40000000000:4294967296 -0o40000000001:4294967297 - -0o17777777777776:1099511627774 -0o17777777777777:1099511627775 -0o20000000000000:1099511627776 -0o20000000000001:1099511627777 - -0o7777777777777776:281474976710654 -0o7777777777777777:281474976710655 -0o10000000000000000:281474976710656 -0o10000000000000001:281474976710657 - -0o3777777777777777776:72057594037927934 -0o3777777777777777777:72057594037927935 -0o4000000000000000000:72057594037927936 -0o4000000000000000001:72057594037927937 - -0O10:8 -o10:8 -O10:8 - -NaN:NaN -+inf:NaN --inf:NaN diff --git a/cpan/Math-BigInt/t/inf_nan.t b/cpan/Math-BigInt/t/inf_nan.t index 9634396b71..b8c792d914 100644 --- a/cpan/Math-BigInt/t/inf_nan.t +++ b/cpan/Math-BigInt/t/inf_nan.t @@ -1,13 +1,12 @@ # -*- mode: perl; -*- # test inf/NaN handling all in one place -# Thanx to Jarkko for the excellent explanations and the tables use strict; use warnings; use lib 't'; -use Test::More tests => 2052; +use Test::More tests => 1044; use Math::BigInt; use Math::BigFloat; @@ -17,7 +16,7 @@ use Math::BigFloat::Subclass; my @biclasses = qw/ Math::BigInt Math::BigInt::Subclass /; my @bfclasses = qw/ Math::BigFloat Math::BigFloat::Subclass /; -my (@args, $x, $y, $z); +my (@args, $x, $y, $z, $test); # + @@ -75,13 +74,25 @@ foreach (qw/ { @args = split /:/, $_; for my $class (@biclasses, @bfclasses) { + $args[2] = '0' if $args[2] eq '-0'; # Math::Big* has no -0 $x = $class->new($args[0]); $y = $class->new($args[1]); - $args[2] = '0' if $args[2] eq '-0'; # Math::Big(Int|Float) has no -0 - my $r = $x->badd($y); - - is($x->bstr(), $args[2], "x $class $args[0] + $args[1]"); - is($x->bstr(), $args[2], "r $class $args[0] + $args[1]"); + $z = $x->badd($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$z = \$x->badd(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($z), $class, "\$z is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($z->bstr(), $args[2], 'value of $z'); + }; } } @@ -141,13 +152,25 @@ foreach (qw/ { @args = split /:/, $_; for my $class (@biclasses, @bfclasses) { + $args[2] = '0' if $args[2] eq '-0'; # Math::Big* has no -0 $x = $class->new($args[0]); $y = $class->new($args[1]); - $args[2] = '0' if $args[2] eq '-0'; # Math::Big(Int|Float) has no -0 - my $r = $x->bsub($y); - - is($x->bstr(), $args[2], "x $class $args[0] - $args[1]"); - is($r->bstr(), $args[2], "r $class $args[0] - $args[1]"); + $z = $x->bsub($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$z = \$x->bsub(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($z), $class, "\$z is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($z->bstr(), $args[2], 'value of $z'); + }; } } @@ -207,13 +230,25 @@ foreach (qw/ { @args = split /:/, $_; for my $class (@biclasses, @bfclasses) { + $args[2] = '0' if $args[2] eq '-0'; # Math::Big* has no -0 $x = $class->new($args[0]); $y = $class->new($args[1]); - $args[2] = '0' if $args[2] eq '-0'; # Math::Big(Int|Float) has no -0 - my $r = $x->bmul($y); - - is($x->bstr(), $args[2], "x $class $args[0] * $args[1]"); - is($r->bstr(), $args[2], "r $class $args[0] * $args[1]"); + $z = $x->bmul($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$z = \$x->bmul(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($z), $class, "\$z is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($z->bstr(), $args[2], 'value of $z'); + }; } } @@ -273,34 +308,80 @@ foreach (qw/ { @args = split /:/, $_; for my $class (@biclasses, @bfclasses) { - $x = $class->new($args[0]); - $y = $class->new($args[1]); - $args[2] = '0' if $args[2] eq '-0'; # Math::Big(Int|Float) has no -0 + $args[2] = '0' if $args[2] eq '-0'; # Math::Big* has no -0 - my $t = $x->copy(); - my $tmod = $t->copy(); + my ($q, $r); # bdiv in scalar context + + $x = $class->new($args[0]); + $y = $class->new($args[1]); + unless ($class =~ /^Math::BigFloat/) { - my $r = $x->bdiv($y); - is($x->bstr(), $args[2], "x $class $args[0] / $args[1]"); - is($r->bstr(), $args[2], "r $class $args[0] / $args[1]"); + $q = $x->bdiv($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$q = \$x->bdiv(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($q), $class, "\$q is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($q->bstr(), $args[2], 'value of $q'); + }; } # bmod and bdiv in list context - my ($d, $rem) = $t->bdiv($y); + + $x = $class->new($args[0]); + $y = $class->new($args[1]); + + ($q, $r) = $x->bdiv($y); # bdiv in list context - is($t->bstr(), $args[2], "t $class $args[0] / $args[1]"); - is($d->bstr(), $args[2], "d $class $args[0] / $args[1]"); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|(\$q, \$r) = \$x->bdiv(\$y);|; + + subtest $test => sub { + plan tests => 7; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($q), $class, "\$q is a $class"); + is(ref($r), $class, "\$r is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($q->bstr(), $args[2], 'value of $q'); + }; # bmod - my $m = $tmod->bmod($y); - # bmod() agrees with bdiv? - is($m->bstr(), $rem->bstr(), "m $class $args[0] % $args[1]"); - # bmod() return agrees with set value? - is($tmod->bstr(), $m->bstr(), "o $class $args[0] % $args[1]"); + $x = $class->new($args[0]); + $y = $class->new($args[1]); + + my $m = $x->bmod($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$m = \$x->bmod(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($m), $class, "\$m is a $class"); + is($x->bstr(), $r->bstr(), 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($m->bstr(), $r->bstr(), 'value of $m'); + }; } } @@ -360,17 +441,25 @@ foreach (qw/ { @args = split /:/, $_; for my $class (@bfclasses) { + $args[2] = '0' if $args[2] eq '-0'; # Math::Big* has no -0 $x = $class->new($args[0]); $y = $class->new($args[1]); - $args[2] = '0' if $args[2] eq '-0'; # Math::Big(Int|Float) has no -0 - - my $t = $x->copy(); - my $tmod = $t->copy(); - - # bdiv in scalar context - my $r = $x->bdiv($y); - is($x->bstr(), $args[2], "x $class $args[0] / $args[1]"); - is($r->bstr(), $args[2], "r $class $args[0] / $args[1]"); + $z = $x->bdiv($y); + + $test = qq|\$x = $class->new("$args[0]"); | + . qq|\$y = $class->new("$args[1]"); | + . qq|\$z = \$x->bdiv(\$y);|; + + subtest $test => sub { + plan tests => 6; + + is(ref($x), $class, "\$x is a $class"); + is(ref($y), $class, "\$y is still a $class"); + is(ref($z), $class, "\$z is a $class"); + is($x->bstr(), $args[2], 'value of $x'); + is($y->bstr(), $args[1], 'value of $y'); + is($z->bstr(), $args[2], 'value of $z'); + }; } } @@ -378,9 +467,9 @@ foreach (qw/ # overloaded comparisons foreach my $c (@biclasses, @bfclasses) { - my $x = $c->bnan(); - my $y = $c->bnan(); # test with two different objects, too - my $z = $c->bzero(); + $x = $c->bnan(); + $y = $c->bnan(); # test with two different objects, too + $z = $c->bzero(); is($x == $y, '', 'NaN == NaN: ""'); is($x != $y, 1, 'NaN != NaN: 1'); diff --git a/cpan/Math-BigInt/t/lib_load-mbf-mbi.t b/cpan/Math-BigInt/t/lib_load-mbf-mbi.t deleted file mode 100644 index e18476ed49..0000000000 --- a/cpan/Math-BigInt/t/lib_load-mbf-mbi.t +++ /dev/null @@ -1,72 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 10; - -use lib "t"; - -# First load Math::BigFloat with Math::BigInt::Calc. - -use Math::BigFloat lib => "Calc"; - -is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - 'Math::BigFloat -> config("lib")'); - -is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - 'ref Math::BigFloat -> bzero() -> {_m}'); - -# Math::BigInt will know that we loaded Math::BigInt::Calc. - -require Math::BigInt; - -is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - 'Math::BigInt -> config("lib")'); - -is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - "ref Math::BigInt -> bzero() -> {value}"); - -# Now load Math::BigFloat again with a different lib. - -Math::BigFloat -> import(lib => "BareCalc"); - -is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - 'Math::BigFloat -> config("lib")'); - -is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - 'ref Math::BigFloat -> bzero() -> {_m}'); - -# See if Math::BigInt knows about Math::BigInt::BareCalc. - -is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - "Math::BigInt is using library Math::BigInt::Calc"); - -is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - "ref Math::BigInt -> bzero() -> {value}"); - -# See that Math::BigInt supports "only". - -eval { Math::BigInt -> import("only" => "Calc") }; -subtest 'Math::BigInt -> import("only" => "Calc")' => sub { - plan tests => 3; - - is($@, "", '$@ is empty'); - is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - 'Math::BigInt -> config("lib")'); - is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - "ref Math::BigInt -> bzero() -> {value}"); -}; - -# See that Math::BigInt supports "try". - -eval { Math::BigInt -> import("try" => "BareCalc") }; -subtest 'Math::BigInt -> import("try" => "BareCalc")' => sub { - plan tests => 3; - - is($@, "", '$@ is empty'); - is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - 'Math::BigInt -> config("lib")'); - is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - "ref Math::BigInt -> bzero() -> {value}"); -} diff --git a/cpan/Math-BigInt/t/lib_load-mbi-mbf.t b/cpan/Math-BigInt/t/lib_load-mbi-mbf.t deleted file mode 100644 index 8868667fe3..0000000000 --- a/cpan/Math-BigInt/t/lib_load-mbi-mbf.t +++ /dev/null @@ -1,72 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 10; - -use lib "t"; - -# First load Math::BigInt with Math::BigInt::Calc. - -use Math::BigInt lib => "Calc"; - -is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - 'Math::BigInt -> config("lib")'); - -is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - 'ref Math::BigInt -> bzero() -> {value}'); - -# Math::BigFloat will know that we loaded Math::BigInt::Calc. - -require Math::BigFloat; - -is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - 'Math::BigFloat -> config("lib")'); - -is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - "ref Math::BigFloat -> bzero() -> {_m}"); - -# Now load Math::BigInt again with a different lib. - -Math::BigInt -> import(lib => "BareCalc"); - -is(Math::BigInt -> config("lib"), "Math::BigInt::Calc", - 'Math::BigInt -> config("lib")'); - -is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc", - 'ref Math::BigInt -> bzero() -> {value}'); - -# See if Math::BigFloat knows about Math::BigInt::BareCalc. - -is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - "Math::BigFloat is using library Math::BigInt::Calc"); - -is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - "ref Math::BigFloat -> bzero() -> {_m}"); - -# See that Math::BigFloat supports "only". - -eval { Math::BigFloat -> import("only" => "Calc") }; -subtest 'Math::BigFloat -> import("only" => "Calc")' => sub { - plan tests => 3; - - is($@, "", '$@ is empty'); - is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - 'Math::BigFloat -> config("lib")'); - is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - "ref Math::BigFloat -> bzero() -> {_m}"); -}; - -# See that Math::BigFloat supports "try". - -eval { Math::BigFloat -> import("try" => "BareCalc") }; -subtest 'Math::BigFloat -> import("try" => "BareCalc")' => sub { - plan tests => 3; - - is($@, "", '$@ is empty'); - is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc", - 'Math::BigFloat -> config("lib")'); - is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc", - "ref Math::BigFloat -> bzero() -> {_m}"); -} diff --git a/cpan/Math-BigInt/t/mbimbf.inc b/cpan/Math-BigInt/t/mbimbf.inc index 7a52d73c8a..c3b458f300 100644 --- a/cpan/Math-BigInt/t/mbimbf.inc +++ b/cpan/Math-BigInt/t/mbimbf.inc @@ -417,17 +417,15 @@ $x = $mbi->new(123400); $x->{_a} = 4; is($x->bnot(), -123400, q|$x->bnot()|); # not -1234001 -# both babs() and bneg() don't need to round, since the input will already -# be rounded (either as $x or via new($string)), and they don't change the -# value. The two tests below peek at this by using _a (illegally) directly +# to be consistent with other methods, babs() and bneg() also support rounding $x = $mbi->new(-123401); $x->{_a} = 4; -is($x->babs(), 123401, q|$x->babs()|); +is($x->babs(), 123400, q|$x->babs()|); $x = $mbi->new(-123401); $x->{_a} = 4; -is($x->bneg(), 123401, q|$x->bneg()|); +is($x->bneg(), 123400, q|$x->bneg()|); # test bdiv rounding to A and R (bug in v1.48 and maybe earlier versions) @@ -1293,7 +1291,7 @@ while (<DATA>) { $try .= qq| \$y->accuracy($ya);| if $ya ne ''; $try .= qq| \$y->precision($yp);| if $yp ne ''; - $try .= ' $x->$f($y);'; + $try .= ' $x->' . $f . '($y);'; # print "trying $try\n"; $rc = eval $try; diff --git a/cpan/Math-BigInt/t/new-mbf.t b/cpan/Math-BigInt/t/new-mbf.t deleted file mode 100644 index d4fa8b6017..0000000000 --- a/cpan/Math-BigInt/t/new-mbf.t +++ /dev/null @@ -1,303 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 112; - -use Scalar::Util qw< refaddr >; - -my $class; - -BEGIN { $class = 'Math::BigFloat'; } -BEGIN { use_ok($class, '1.999821'); } - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - my $x; - - my $test = qq|\$x = $class -> new("$in0");|; - my $desc = $test; - - eval $test; - die $@ if $@; # this should never happen - - subtest $desc, sub { - plan tests => 2, - - # Check output. - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - -} - -# new() - -{ - my $x = $class -> new(); - subtest qq|\$x = $class -> new();|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); - is($x, "0", 'output arg has the right value'); - }; -} - -# new("") - -{ - no warnings "numeric"; - my $x = $class -> new(""); - subtest qq|\$x = $class -> new("");|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); -# is($x, "0", 'output arg has the right value'); - is($x, "NaN", 'output arg has the right value'); - }; -} - -# new(undef) - -{ - no warnings "uninitialized"; - my $x = $class -> new(undef); - subtest qq|\$x = $class -> new(undef);|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); - is($x, "0", 'output arg has the right value'); - }; -} - -# new($x) -# -# In this case, when $x isa Math::BigFloat, only the sign and value should be -# copied from $x, not the accuracy or precision. - -SKIP: { - skip "This test reveals a bug that has not been fixed yet", 2; - - my ($a, $p, $x, $y); - - $a = $class -> accuracy(); # get original - $class -> accuracy(4711); # set new global value - $x = $class -> new("314"); # create object - $x -> accuracy(41); # set instance value - $y = $class -> new($x); # create new object - is($y -> accuracy(), 4711, 'object has the global accuracy'); - $class -> accuracy($a); # reset - - $p = $class -> precision(); # get original - $class -> precision(4711); # set new global value - $x = $class -> new("314"); # create object - $x -> precision(41); # set instance value - $y = $class -> new($x); # create new object - is($y -> precision(), 4711, 'object has the global precision'); - $class -> precision($p); # reset -} - -# Make sure that library thingies are indeed copied. - -{ - my ($x, $y); - - $x = $class -> new("314"); # create object - $y = $class -> new($x); # create new object - subtest 'library thingy is copied' => sub { - my @keys = ('_m', '_e'); - plan tests => scalar @keys; - for my $key (@keys) { - isnt(refaddr($y -> {$key}), refaddr($x -> {$key}), - 'library thingy is a copy'); - } - }; -} - -# Other tests where we must use the scientific notation in the output. - -for my $str (qw/ - 1e+4294967296 - 1e+18446744073709551616 - 1e+79228162514264337593543950336 - 1e+340282366920938463463374607431768211456 - 1e+1461501637330902918203684832716283019655932542976 - 1e+6277101735386680763835789423207666416102355444464034512896 - /) -{ - my $x; - $x = $class -> new($str); - subtest $str, sub { - plan tests => 2, - - is(ref($x), $class, "output arg is a $class"); - is($x -> bnstr(), $str, 'output arg has the right value'); - } -} - -__END__ - -NaN:NaN -inf:inf -infinity:inf -+inf:inf -+infinity:inf --inf:-inf --infinity:-inf - -# This is the same data as in from_bin-mbf.t, except that some of them are -# commented out, since new() only treats input as binary if it has a "0b" or -# "0B" prefix, possibly with a leading "+" or "-" sign. Duplicates from above -# are also commented out. - -0b1p+0:1 -0b.1p+1:1 -0b.01p+2:1 -0b.001p+3:1 -0b.0001p+4:1 -0b10p-1:1 -0b100p-2:1 -0b1000p-3:1 - --0b1p+0:-1 - -0b0p+0:0 -0b0p+7:0 -0b0p-7:0 -0b0.p+0:0 -0b.0p+0:0 -0b0.0p+0:0 - -0b1100101011111110:51966 -0B1100101011111110:51966 -b1100101011111110:51966 -B1100101011111110:51966 -#1100101011111110:51966 - -0b1.1001p+3:12.5 -0b10010.001101p-1:9.1015625 --0b.11110001001101010111100110111101111p+31:-2023406814.9375 -0b10.0100011010001010110011110001001101p+34:39093746765 - -0b.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN - -# This is more or less the same data as in from_oct-mbf.t, except that some of -# them are commented out, since new() does not consider a number with just a -# leading zero to be an octal number. Duplicates from above are also commented -# out. - -# Without "0o" prefix. - -001p+0:1 -00.4p+1:1 -00.2p+2:1 -00.1p+3:1 -00.04p+4:1 -02p-1:1 -04p-2:1 -010p-3:1 - --01p+0:-1 - -00p+0:0 -00p+7:0 -00p-7:0 -00.p+0:0 -00.0p+0:0 - -#145376:51966 -#0145376:51966 -#00145376:51966 - -03.1p+2:12.5 -022.15p-1:9.1015625 --00.361152746757p+32:-2023406814.9375 -044.3212636115p+30:39093746765 - -0.p+0:NaN -.p+0:NaN - -# With "0o" prefix. - -0o01p+0:1 -0o0.4p+1:1 -0o0.2p+2:1 -0o0.1p+3:1 -0o0.04p+4:1 -0o02p-1:1 -0o04p-2:1 -0o010p-3:1 - --0o1p+0:-1 - -0o0p+0:0 -0o0p+7:0 -0o0p-7:0 -0o0.p+0:0 -0o.0p+0:0 -0o0.0p+0:0 - -0o145376:51966 -0O145376:51966 -o145376:51966 -O145376:51966 - -0o3.1p+2:12.5 -0o22.15p-1:9.1015625 --0o0.361152746757p+32:-2023406814.9375 -0o44.3212636115p+30:39093746765 - -0o.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN - -# This is the same data as in from_hex-mbf.t, except that some of them are -# commented out, since new() only treats input as hexadecimal if it has a "0x" -# or "0X" prefix, possibly with a leading "+" or "-" sign. - -0x1p+0:1 -0x.8p+1:1 -0x.4p+2:1 -0x.2p+3:1 -0x.1p+4:1 -0x2p-1:1 -0x4p-2:1 -0x8p-3:1 - --0x1p+0:-1 - -0x0p+0:0 -0x0p+7:0 -0x0p-7:0 -0x0.p+0:0 -0x.0p+0:0 -0x0.0p+0:0 - -0xcafe:51966 -0Xcafe:51966 -xcafe:51966 -Xcafe:51966 -#cafe:51966 - -0x1.9p+3:12.5 -0x12.34p-1:9.1015625 --0x.789abcdefp+32:-2023406814.9375 -0x12.3456789ap+31:39093746765 - -0x.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN diff --git a/cpan/Math-BigInt/t/new-mbi.t b/cpan/Math-BigInt/t/new-mbi.t deleted file mode 100644 index 07d826d4ca..0000000000 --- a/cpan/Math-BigInt/t/new-mbi.t +++ /dev/null @@ -1,279 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 106; - -use Scalar::Util qw< refaddr >; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($in0, $out0) = split /:/; - my $x; - my $test = qq|\$x = $class -> new("$in0");|; - my $desc = $test; - - eval $test; - die $@ if $@; # this should never happen - - subtest $desc, sub { - plan tests => 2, - - # Check output. - - is(ref($x), $class, "output arg is a $class"); - is($x, $out0, 'output arg has the right value'); - }; - -} - -# new() - -{ - my $x = $class -> new(); - subtest qq|\$x = $class -> new();|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); - is($x, "0", 'output arg has the right value'); - }; -} - -# new("") - -{ - no warnings "numeric"; - my $x = $class -> new(""); - subtest qq|\$x = $class -> new("");|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); - #is($x, "0", 'output arg has the right value'); - is($x, "NaN", 'output arg has the right value'); - }; -} - -# new(undef) - -{ - no warnings "uninitialized"; - my $x = $class -> new(undef); - subtest qq|\$x = $class -> new(undef);|, => sub { - plan tests => 2; - - is(ref($x), $class, "output arg is a $class"); - is($x, "0", 'output arg has the right value'); - }; -} - -# new($x) -# -# In this case, when $x isa Math::BigInt, only the sign and value should be -# copied from $x, not the accuracy or precision. - -{ - my ($a, $p, $x, $y); - - $a = $class -> accuracy(); # get original - $class -> accuracy(4711); # set new global value - $x = $class -> new("314"); # create object - $x -> accuracy(41); # set instance value - $y = $class -> new($x); # create new object - is($y -> accuracy(), 4711, 'object has the global accuracy'); - $class -> accuracy($a); # reset - - $p = $class -> precision(); # get original - $class -> precision(4711); # set new global value - $x = $class -> new("314"); # create object - $x -> precision(41); # set instance value - $y = $class -> new($x); # create new object - is($y -> precision(), 4711, 'object has the global precision'); - $class -> precision($p); # reset -} - -# Make sure that library thingies are indeed copied. - -{ - my ($x, $y); - - $x = $class -> new("314"); # create object - $y = $class -> new($x); # create new object - subtest 'library thingy is copied' => sub { - my @keys = ('value'); - plan tests => scalar @keys; - for my $key (@keys) { - isnt(refaddr($y -> {$key}), refaddr($x -> {$key}), - 'library thingy is a copy'); - } - }; -} - -__END__ - -NaN:NaN -inf:inf -infinity:inf -+inf:inf -+infinity:inf --inf:-inf --infinity:-inf - -# This is the same data as in from_bin-mbf.t, except that some of them are -# commented out, since new() only treats input as binary if it has a "0b" or -# "0B" prefix, possibly with a leading "+" or "-" sign. Duplicates from above -# are also commented out. - -0b1p+0:1 -0b.1p+1:1 -0b.01p+2:1 -0b.001p+3:1 -0b.0001p+4:1 -0b10p-1:1 -0b100p-2:1 -0b1000p-3:1 - --0b1p+0:-1 - -0b0p+0:0 -0b0p+7:0 -0b0p-7:0 -0b0.p+0:0 -0b.0p+0:0 -0b0.0p+0:0 - -0b1100101011111110:51966 -0B1100101011111110:51966 -b1100101011111110:51966 -B1100101011111110:51966 -#1100101011111110:51966 - -0b1.1001p+3:NaN -0b10010.001101p-1:NaN --0b.11110001001101010111100110111101111p+31:NaN -0b10.0100011010001010110011110001001101p+34:39093746765 - -0b.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN - -# This is more or less the same data as in from_oct-mbf.t, except that some of -# them are commented out, since new() does not consider a number with just a -# leading zero to be an octal number. Duplicates from above are also commented -# out. - -# Without "0o" prefix. - -001p+0:1 -00.4p+1:1 -00.2p+2:1 -00.1p+3:1 -00.04p+4:1 -02p-1:1 -04p-2:1 -010p-3:1 - --01p+0:-1 - -00p+0:0 -00p+7:0 -00p-7:0 -00.p+0:0 -00.0p+0:0 - -#145376:51966 -#0145376:51966 -#00145376:51966 - -03.1p+2:NaN -022.15p-1:NaN --00.361152746757p+32:NaN -044.3212636115p+30:39093746765 - -0.p+0:NaN -.p+0:NaN - -# With "0o" prefix. - -0o01p+0:1 -0o0.4p+1:1 -0o0.2p+2:1 -0o0.1p+3:1 -0o0.04p+4:1 -0o02p-1:1 -0o04p-2:1 -0o010p-3:1 - --0o1p+0:-1 - -0o0p+0:0 -0o0p+7:0 -0o0p-7:0 -0o0.p+0:0 -0o.0p+0:0 -0o0.0p+0:0 - -0o145376:51966 -0O145376:51966 -o145376:51966 -O145376:51966 - -0o3.1p+2:NaN -0o22.15p-1:NaN --0o0.361152746757p+32:NaN -0o44.3212636115p+30:39093746765 - -0o.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN - -# This is the same data as in from_hex-mbf.t, except that some of them are -# commented out, since new() only treats input as hexadecimal if it has a "0x" -# or "0X" prefix, possibly with a leading "+" or "-" sign. - -0x1p+0:1 -0x.8p+1:1 -0x.4p+2:1 -0x.2p+3:1 -0x.1p+4:1 -0x2p-1:1 -0x4p-2:1 -0x8p-3:1 - --0x1p+0:-1 - -0x0p+0:0 -0x0p+7:0 -0x0p-7:0 -0x0.p+0:0 -0x.0p+0:0 -0x0.0p+0:0 - -0xcafe:51966 -0Xcafe:51966 -xcafe:51966 -Xcafe:51966 -#cafe:51966 - -0x1.9p+3:NaN -0x12.34p-1:NaN --0x.789abcdefp+32:NaN -0x12.3456789ap+31:39093746765 - -0x.p+0:NaN - -#NaN:NaN -#+inf:NaN -#-inf:NaN diff --git a/cpan/Math-BigInt/t/nparts-mbf.t b/cpan/Math-BigInt/t/nparts-mbf.t deleted file mode 100644 index 0c558ad3be..0000000000 --- a/cpan/Math-BigInt/t/nparts-mbf.t +++ /dev/null @@ -1,294 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1840; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> nparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my ($mant_got, $expo_got) = $x -> nparts(); - - isa_ok($mant_got, "Math::BigFloat"); - isa_ok($expo_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| \$m = \$x -> nparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my $mant_got = $x -> nparts(); - - isa_ok($mant_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -0.000000000001:1:-12 -0.00000000001:1:-11 -0.0000000001:1:-10 -0.000000001:1:-9 -0.00000001:1:-8 -0.0000001:1:-7 -0.000001:1:-6 -0.00001:1:-5 -0.0001:1:-4 -0.001:1:-3 -0.01:1:-2 -0.1:1:-1 -1:1:0 -10:1:1 -100:1:2 -1000:1:3 -10000:1:4 -100000:1:5 -1000000:1:6 -10000000:1:7 -100000000:1:8 -1000000000:1:9 -10000000000:1:10 -100000000000:1:11 -1000000000000:1:12 - -0.0000000000012:1.2:-12 -0.000000000012:1.2:-11 -0.00000000012:1.2:-10 -0.0000000012:1.2:-9 -0.000000012:1.2:-8 -0.00000012:1.2:-7 -0.0000012:1.2:-6 -0.000012:1.2:-5 -0.00012:1.2:-4 -0.0012:1.2:-3 -0.012:1.2:-2 -0.12:1.2:-1 -1.2:1.2:0 -12:1.2:1 -120:1.2:2 -1200:1.2:3 -12000:1.2:4 -120000:1.2:5 -1200000:1.2:6 -12000000:1.2:7 -120000000:1.2:8 -1200000000:1.2:9 -12000000000:1.2:10 -120000000000:1.2:11 -1200000000000:1.2:12 - -0.00000000000123:1.23:-12 -0.0000000000123:1.23:-11 -0.000000000123:1.23:-10 -0.00000000123:1.23:-9 -0.0000000123:1.23:-8 -0.000000123:1.23:-7 -0.00000123:1.23:-6 -0.0000123:1.23:-5 -0.000123:1.23:-4 -0.00123:1.23:-3 -0.0123:1.23:-2 -0.123:1.23:-1 -1.23:1.23:0 -12.3:1.23:1 -123:1.23:2 -1230:1.23:3 -12300:1.23:4 -123000:1.23:5 -1230000:1.23:6 -12300000:1.23:7 -123000000:1.23:8 -1230000000:1.23:9 -12300000000:1.23:10 -123000000000:1.23:11 -1230000000000:1.23:12 - -0.000000000001234:1.234:-12 -0.00000000001234:1.234:-11 -0.0000000001234:1.234:-10 -0.000000001234:1.234:-9 -0.00000001234:1.234:-8 -0.0000001234:1.234:-7 -0.000001234:1.234:-6 -0.00001234:1.234:-5 -0.0001234:1.234:-4 -0.001234:1.234:-3 -0.01234:1.234:-2 -0.1234:1.234:-1 -1.234:1.234:0 -12.34:1.234:1 -123.4:1.234:2 -1234:1.234:3 -12340:1.234:4 -123400:1.234:5 -1234000:1.234:6 -12340000:1.234:7 -123400000:1.234:8 -1234000000:1.234:9 -12340000000:1.234:10 -123400000000:1.234:11 -1234000000000:1.234:12 - -0.000003141592:3.141592:-6 -0.00003141592:3.141592:-5 -0.0003141592:3.141592:-4 -0.003141592:3.141592:-3 -0.03141592:3.141592:-2 -0.3141592:3.141592:-1 -3.141592:3.141592:0 -31.41592:3.141592:1 -314.1592:3.141592:2 -3141.592:3.141592:3 -31415.92:3.141592:4 -314159.2:3.141592:5 -3141592:3.141592:6 - -# negativ: numbers - --0.000000000001:-1:-12 --0.00000000001:-1:-11 --0.0000000001:-1:-10 --0.000000001:-1:-9 --0.00000001:-1:-8 --0.0000001:-1:-7 --0.000001:-1:-6 --0.00001:-1:-5 --0.0001:-1:-4 --0.001:-1:-3 --0.01:-1:-2 --0.1:-1:-1 --1:-1:0 --10:-1:1 --100:-1:2 --1000:-1:3 --10000:-1:4 --100000:-1:5 --1000000:-1:6 --10000000:-1:7 --100000000:-1:8 --1000000000:-1:9 --10000000000:-1:10 --100000000000:-1:11 --1000000000000:-1:12 - --0.0000000000012:-1.2:-12 --0.000000000012:-1.2:-11 --0.00000000012:-1.2:-10 --0.0000000012:-1.2:-9 --0.000000012:-1.2:-8 --0.00000012:-1.2:-7 --0.0000012:-1.2:-6 --0.000012:-1.2:-5 --0.00012:-1.2:-4 --0.0012:-1.2:-3 --0.012:-1.2:-2 --0.12:-1.2:-1 --1.2:-1.2:0 --12:-1.2:1 --120:-1.2:2 --1200:-1.2:3 --12000:-1.2:4 --120000:-1.2:5 --1200000:-1.2:6 --12000000:-1.2:7 --120000000:-1.2:8 --1200000000:-1.2:9 --12000000000:-1.2:10 --120000000000:-1.2:11 --1200000000000:-1.2:12 - --0.00000000000123:-1.23:-12 --0.0000000000123:-1.23:-11 --0.000000000123:-1.23:-10 --0.00000000123:-1.23:-9 --0.0000000123:-1.23:-8 --0.000000123:-1.23:-7 --0.00000123:-1.23:-6 --0.0000123:-1.23:-5 --0.000123:-1.23:-4 --0.00123:-1.23:-3 --0.0123:-1.23:-2 --0.123:-1.23:-1 --1.23:-1.23:0 --12.3:-1.23:1 --123:-1.23:2 --1230:-1.23:3 --12300:-1.23:4 --123000:-1.23:5 --1230000:-1.23:6 --12300000:-1.23:7 --123000000:-1.23:8 --1230000000:-1.23:9 --12300000000:-1.23:10 --123000000000:-1.23:11 --1230000000000:-1.23:12 - --0.000000000001234:-1.234:-12 --0.00000000001234:-1.234:-11 --0.0000000001234:-1.234:-10 --0.000000001234:-1.234:-9 --0.00000001234:-1.234:-8 --0.0000001234:-1.234:-7 --0.000001234:-1.234:-6 --0.00001234:-1.234:-5 --0.0001234:-1.234:-4 --0.001234:-1.234:-3 --0.01234:-1.234:-2 --0.1234:-1.234:-1 --1.234:-1.234:0 --12.34:-1.234:1 --123.4:-1.234:2 --1234:-1.234:3 --12340:-1.234:4 --123400:-1.234:5 --1234000:-1.234:6 --12340000:-1.234:7 --123400000:-1.234:8 --1234000000:-1.234:9 --12340000000:-1.234:10 --123400000000:-1.234:11 --1234000000000:-1.234:12 - --0.000003141592:-3.141592:-6 --0.00003141592:-3.141592:-5 --0.0003141592:-3.141592:-4 --0.003141592:-3.141592:-3 --0.03141592:-3.141592:-2 --0.3141592:-3.141592:-1 --3.141592:-3.141592:0 --31.41592:-3.141592:1 --314.1592:-3.141592:2 --3141.592:-3.141592:3 --31415.92:-3.141592:4 --314159.2:-3.141592:5 --3141592:-3.141592:6 diff --git a/cpan/Math-BigInt/t/nparts-mbi.t b/cpan/Math-BigInt/t/nparts-mbi.t deleted file mode 100644 index a970535339..0000000000 --- a/cpan/Math-BigInt/t/nparts-mbi.t +++ /dev/null @@ -1,162 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 784; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> nparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my ($mant_got, $expo_got) = $x -> nparts(); - - isa_ok($mant_got, "Math::BigInt"); - isa_ok($expo_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| \$m = \$x -> nparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my $mant_got = $x -> nparts(); - - isa_ok($mant_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -1:1:0 -10:1:1 -100:1:2 -1000:1:3 -10000:1:4 -100000:1:5 -1000000:1:6 -10000000:1:7 -100000000:1:8 -1000000000:1:9 -10000000000:1:10 -100000000000:1:11 -1000000000000:1:12 - -12:NaN:1 -120:NaN:2 -1200:NaN:3 -12000:NaN:4 -120000:NaN:5 -1200000:NaN:6 -12000000:NaN:7 -120000000:NaN:8 -1200000000:NaN:9 -12000000000:NaN:10 -120000000000:NaN:11 -1200000000000:NaN:12 - -123:NaN:2 -1230:NaN:3 -12300:NaN:4 -123000:NaN:5 -1230000:NaN:6 -12300000:NaN:7 -123000000:NaN:8 -1230000000:NaN:9 -12300000000:NaN:10 -123000000000:NaN:11 -1230000000000:NaN:12 - -1234:NaN:3 -12340:NaN:4 -123400:NaN:5 -1234000:NaN:6 -12340000:NaN:7 -123400000:NaN:8 -1234000000:NaN:9 -12340000000:NaN:10 -123400000000:NaN:11 -1234000000000:NaN:12 - -3141592:NaN:6 - -# negativ: numbers - --1:-1:0 --10:-1:1 --100:-1:2 --1000:-1:3 --10000:-1:4 --100000:-1:5 --1000000:-1:6 --10000000:-1:7 --100000000:-1:8 --1000000000:-1:9 --10000000000:-1:10 --100000000000:-1:11 --1000000000000:-1:12 - --12:NaN:1 --120:NaN:2 --1200:NaN:3 --12000:NaN:4 --120000:NaN:5 --1200000:NaN:6 --12000000:NaN:7 --120000000:NaN:8 --1200000000:NaN:9 --12000000000:NaN:10 --120000000000:NaN:11 --1200000000000:NaN:12 - --123:NaN:2 --1230:NaN:3 --12300:NaN:4 --123000:NaN:5 --1230000:NaN:6 --12300000:NaN:7 --123000000:NaN:8 --1230000000:NaN:9 --12300000000:NaN:10 --123000000000:NaN:11 --1230000000000:NaN:12 - --1234:NaN:3 --12340:NaN:4 --123400:NaN:5 --1234000:NaN:6 --12340000:NaN:7 --123400000:NaN:8 --1234000000:NaN:9 --12340000000:NaN:10 --123400000000:NaN:11 --1234000000000:NaN:12 - --3141592:NaN:6 diff --git a/cpan/Math-BigInt/t/objectify_mbf.t b/cpan/Math-BigInt/t/objectify_mbf.t deleted file mode 100644 index 8ea7abe1e0..0000000000 --- a/cpan/Math-BigInt/t/objectify_mbf.t +++ /dev/null @@ -1,99 +0,0 @@ -# -*- mode: perl; -*- -# -# Verify that objectify() is able to convert a "foreign" object into what we -# want, when what we want is Math::BigFloat or subclass thereof. - -use strict; -use warnings; - -package main; - -use Test::More tests => 6; - -use Math::BigFloat; - -############################################################################### - -for my $class ('Math::BigFloat', 'Math::BigFloat::Subclass') { - - # This object defines what we want. - - my $float = $class -> new(10); - - # Create various objects that should work with the object above after - # objectify() has done its thing. - - my $float_percent1 = My::Percent::Float1 -> new(100); - is($float * $float_percent1, 10, - qq|\$float = $class -> new(10);| - . q| $float_percent1 = My::Percent::Float1 -> new(100);| - . q| $float * $float_percent1;|); - - my $float_percent2 = My::Percent::Float2 -> new(100); - is($float * $float_percent2, 10, - qq|\$float = $class -> new(10);| - . q| $float_percent2 = My::Percent::Float2 -> new(100);| - . q| $float * $float_percent2;|); - - my $float_percent3 = My::Percent::Float3 -> new(100); - is($float * $float_percent3, 10, - qq|\$float = $class -> new(10);| - . q| $float_percent3 = My::Percent::Float3 -> new(100);| - . q| $float * $float_percent3;|); -} - -############################################################################### -# Class supports as_float(), which returns a Math::BigFloat. - -package My::Percent::Float1; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_float { - my $self = shift; - return Math::BigFloat -> new($$self / 100); -} - -############################################################################### -# Class supports as_float(), which returns a scalar. - -package My::Percent::Float2; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_float { - my $self = shift; - return $$self / 100; -} - -############################################################################### -# Class does not support as_float(). - -package My::Percent::Float3; - -use overload '""' => sub { $_[0] -> as_string(); }; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_string { - my $self = shift; - return $$self / 100; -} - -############################################################################### - -package Math::BigFloat::Subclass; - -use base 'Math::BigFloat'; diff --git a/cpan/Math-BigInt/t/objectify_mbi.t b/cpan/Math-BigInt/t/objectify_mbi.t deleted file mode 100644 index 8efb4520c7..0000000000 --- a/cpan/Math-BigInt/t/objectify_mbi.t +++ /dev/null @@ -1,145 +0,0 @@ -# -*- mode: perl; -*- -# -# Verify that objectify() is able to convert a "foreign" object into what we -# want, when what we want is Math::BigInt or subclass thereof. - -use strict; -use warnings; - -package main; - -use Test::More tests => 10; - -use Math::BigInt; - -############################################################################### - -for my $class ('Math::BigInt', 'Math::BigInt::Subclass') { - - # This object defines what we want. - - my $int = $class -> new(10); - - # Create various objects that should work with the object above after - # objectify() has done its thing. - - my $int_percent1 = My::Percent::Int1 -> new(100); - is($int * $int_percent1, 10, - qq|\$class -> new(10);| - . q| $int_percent1 = My::Percent::Int1 -> new(100);| - . q| $int * $int_percent1|); - - my $int_percent2 = My::Percent::Int2 -> new(100); - is($int * $int_percent2, 10, - qq|\$class -> new(10);| - . q| $int_percent2 = My::Percent::Int2 -> new(100);| - . q| $int * $int_percent2|); - - my $int_percent3 = My::Percent::Int3 -> new(100); - is($int * $int_percent3, 10, - qq|\$class -> new(10);| - . q| $int_percent3 = My::Percent::Int3 -> new(100);| - . q| $int * $int_percent3|); - - my $int_percent4 = My::Percent::Int4 -> new(100); - is($int * $int_percent4, 10, - qq|\$class -> new(10);| - . q| $int_percent4 = My::Percent::Int4 -> new(100);| - . q| $int * $int_percent4|); - - my $int_percent5 = My::Percent::Int5 -> new(100); - is($int * $int_percent5, 10, - qq|\$class -> new(10);| - . q| $int_percent5 = My::Percent::Int5 -> new(100);| - . q| $int * $int_percent5|); -} - -############################################################################### -# Class supports as_int(), which returns a Math::BigInt. - -package My::Percent::Int1; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_int { - my $self = shift; - return Math::BigInt -> new($$self / 100); -} - -############################################################################### -# Class supports as_int(), which returns a scalar. - -package My::Percent::Int2; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_int { - my $self = shift; - return $$self / 100; -} - -############################################################################### -# Class does not support as_int(), but supports as_number(), which returns a -# Math::BigInt. - -package My::Percent::Int3; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_number { - my $self = shift; - return Math::BigInt -> new($$self / 100); -} - -############################################################################### -# Class does not support as_int(), but supports as_number(), which returns a -# scalar. - -package My::Percent::Int4; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_number { - my $self = shift; - return $$self / 100; -} - -############################################################################### -# Class supports neither as_int() or as_number(). - -package My::Percent::Int5; - -use overload '""' => sub { $_[0] -> as_string(); }; - -sub new { - my $class = shift; - my $num = shift; - return bless \$num, $class; -} - -sub as_string { - my $self = shift; - return $$self / 100; -} - -############################################################################### - -package Math::BigInt::Subclass; - -use base 'Math::BigInt'; diff --git a/cpan/Math-BigInt/t/sparts-mbf.t b/cpan/Math-BigInt/t/sparts-mbf.t deleted file mode 100644 index b1a7a4a87e..0000000000 --- a/cpan/Math-BigInt/t/sparts-mbf.t +++ /dev/null @@ -1,325 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 1848; - -use Math::BigFloat; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> sparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my ($mant_got, $expo_got) = $x -> sparts(); - - isa_ok($mant_got, "Math::BigFloat"); - isa_ok($expo_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigFloat -> new("$x_str");|, - qq| \$m = \$x -> sparts();\n\n|); - - { - my $x = Math::BigFloat -> new($x_str); - my $mant_got = $x -> sparts(); - - isa_ok($mant_got, "Math::BigFloat"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -# Verify that the accuracy of the significand and the exponent depends on the -# accuracy of the invocand, if set, not the class. - -note(qq|\nVerify that accuracy depends on invocand, not class.\n\n|); - -{ - Math::BigFloat -> accuracy(20); - my $x = Math::BigFloat -> new("3"); # accuray is 20 - $x -> accuracy(10); # reduce accuray to 10 - - my ($mant, $expo) = $x -> sparts(); - cmp_ok($mant, '==', 3, "value of significand"); - cmp_ok($expo, '==', 0, "value of exponent"); - cmp_ok($mant -> accuracy(), '==', 10, "accuracy of significand"); - cmp_ok($expo -> accuracy(), '==', 20, "accuracy of exponent"); -} - -note(qq|\nVerify that precision depends on invocand, not class.\n\n|); - -{ - Math::BigFloat -> precision(20); - my $x = Math::BigFloat -> new("3"); # precision is 20 - $x -> precision(10); # reduce precision to 10 - - my ($mant, $expo) = $x -> sparts(); - cmp_ok($mant, '==', 3, "value of significand"); - cmp_ok($expo, '==', 0, "value of exponent"); - cmp_ok($mant -> precision(), '==', 10, "precision of significand"); - cmp_ok($expo -> precision(), '==', 20, "precision of exponent"); -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -0.000000000001:1:-12 -0.00000000001:1:-11 -0.0000000001:1:-10 -0.000000001:1:-9 -0.00000001:1:-8 -0.0000001:1:-7 -0.000001:1:-6 -0.00001:1:-5 -0.0001:1:-4 -0.001:1:-3 -0.01:1:-2 -0.1:1:-1 -1:1:0 -10:1:1 -100:1:2 -1000:1:3 -10000:1:4 -100000:1:5 -1000000:1:6 -10000000:1:7 -100000000:1:8 -1000000000:1:9 -10000000000:1:10 -100000000000:1:11 -1000000000000:1:12 - -0.0000000000012:12:-13 -0.000000000012:12:-12 -0.00000000012:12:-11 -0.0000000012:12:-10 -0.000000012:12:-9 -0.00000012:12:-8 -0.0000012:12:-7 -0.000012:12:-6 -0.00012:12:-5 -0.0012:12:-4 -0.012:12:-3 -0.12:12:-2 -1.2:12:-1 -12:12:0 -120:12:1 -1200:12:2 -12000:12:3 -120000:12:4 -1200000:12:5 -12000000:12:6 -120000000:12:7 -1200000000:12:8 -12000000000:12:9 -120000000000:12:10 -1200000000000:12:11 - -0.00000000000123:123:-14 -0.0000000000123:123:-13 -0.000000000123:123:-12 -0.00000000123:123:-11 -0.0000000123:123:-10 -0.000000123:123:-9 -0.00000123:123:-8 -0.0000123:123:-7 -0.000123:123:-6 -0.00123:123:-5 -0.0123:123:-4 -0.123:123:-3 -1.23:123:-2 -12.3:123:-1 -123:123:0 -1230:123:1 -12300:123:2 -123000:123:3 -1230000:123:4 -12300000:123:5 -123000000:123:6 -1230000000:123:7 -12300000000:123:8 -123000000000:123:9 -1230000000000:123:10 - -0.000000000001234:1234:-15 -0.00000000001234:1234:-14 -0.0000000001234:1234:-13 -0.000000001234:1234:-12 -0.00000001234:1234:-11 -0.0000001234:1234:-10 -0.000001234:1234:-9 -0.00001234:1234:-8 -0.0001234:1234:-7 -0.001234:1234:-6 -0.01234:1234:-5 -0.1234:1234:-4 -1.234:1234:-3 -12.34:1234:-2 -123.4:1234:-1 -1234:1234:0 -12340:1234:1 -123400:1234:2 -1234000:1234:3 -12340000:1234:4 -123400000:1234:5 -1234000000:1234:6 -12340000000:1234:7 -123400000000:1234:8 -1234000000000:1234:9 - -0.000003141592:3141592:-12 -0.00003141592:3141592:-11 -0.0003141592:3141592:-10 -0.003141592:3141592:-9 -0.03141592:3141592:-8 -0.3141592:3141592:-7 -3.141592:3141592:-6 -31.41592:3141592:-5 -314.1592:3141592:-4 -3141.592:3141592:-3 -31415.92:3141592:-2 -314159.2:3141592:-1 -3141592:3141592:0 - -# negativ: numbers - --0.000000000001:-1:-12 --0.00000000001:-1:-11 --0.0000000001:-1:-10 --0.000000001:-1:-9 --0.00000001:-1:-8 --0.0000001:-1:-7 --0.000001:-1:-6 --0.00001:-1:-5 --0.0001:-1:-4 --0.001:-1:-3 --0.01:-1:-2 --0.1:-1:-1 --1:-1:0 --10:-1:1 --100:-1:2 --1000:-1:3 --10000:-1:4 --100000:-1:5 --1000000:-1:6 --10000000:-1:7 --100000000:-1:8 --1000000000:-1:9 --10000000000:-1:10 --100000000000:-1:11 --1000000000000:-1:12 - --0.0000000000012:-12:-13 --0.000000000012:-12:-12 --0.00000000012:-12:-11 --0.0000000012:-12:-10 --0.000000012:-12:-9 --0.00000012:-12:-8 --0.0000012:-12:-7 --0.000012:-12:-6 --0.00012:-12:-5 --0.0012:-12:-4 --0.012:-12:-3 --0.12:-12:-2 --1.2:-12:-1 --12:-12:0 --120:-12:1 --1200:-12:2 --12000:-12:3 --120000:-12:4 --1200000:-12:5 --12000000:-12:6 --120000000:-12:7 --1200000000:-12:8 --12000000000:-12:9 --120000000000:-12:10 --1200000000000:-12:11 - --0.00000000000123:-123:-14 --0.0000000000123:-123:-13 --0.000000000123:-123:-12 --0.00000000123:-123:-11 --0.0000000123:-123:-10 --0.000000123:-123:-9 --0.00000123:-123:-8 --0.0000123:-123:-7 --0.000123:-123:-6 --0.00123:-123:-5 --0.0123:-123:-4 --0.123:-123:-3 --1.23:-123:-2 --12.3:-123:-1 --123:-123:0 --1230:-123:1 --12300:-123:2 --123000:-123:3 --1230000:-123:4 --12300000:-123:5 --123000000:-123:6 --1230000000:-123:7 --12300000000:-123:8 --123000000000:-123:9 --1230000000000:-123:10 - --0.000000000001234:-1234:-15 --0.00000000001234:-1234:-14 --0.0000000001234:-1234:-13 --0.000000001234:-1234:-12 --0.00000001234:-1234:-11 --0.0000001234:-1234:-10 --0.000001234:-1234:-9 --0.00001234:-1234:-8 --0.0001234:-1234:-7 --0.001234:-1234:-6 --0.01234:-1234:-5 --0.1234:-1234:-4 --1.234:-1234:-3 --12.34:-1234:-2 --123.4:-1234:-1 --1234:-1234:0 --12340:-1234:1 --123400:-1234:2 --1234000:-1234:3 --12340000:-1234:4 --123400000:-1234:5 --1234000000:-1234:6 --12340000000:-1234:7 --123400000000:-1234:8 --1234000000000:-1234:9 - --0.000003141592:-3141592:-12 --0.00003141592:-3141592:-11 --0.0003141592:-3141592:-10 --0.003141592:-3141592:-9 --0.03141592:-3141592:-8 --0.3141592:-3141592:-7 --3.141592:-3141592:-6 --31.41592:-3141592:-5 --314.1592:-3141592:-4 --3141.592:-3141592:-3 --31415.92:-3141592:-2 --314159.2:-3141592:-1 --3141592:-3141592:0 diff --git a/cpan/Math-BigInt/t/sparts-mbi.t b/cpan/Math-BigInt/t/sparts-mbi.t deleted file mode 100644 index 5d1dab333f..0000000000 --- a/cpan/Math-BigInt/t/sparts-mbi.t +++ /dev/null @@ -1,193 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 792; - -use Math::BigInt; - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my ($x_str, $mant_str, $expo_str) = split /:/; - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| (\$m, \$e) = \$x -> sparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my ($mant_got, $expo_got) = $x -> sparts(); - - isa_ok($mant_got, "Math::BigInt"); - isa_ok($expo_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($expo_got, $expo_str, "value of exponent"); - is($x, $x_str, "input is unmodified"); - } - - note(qq|\n\$x = Math::BigInt -> new("$x_str");|, - qq| \$m = \$x -> sparts();\n\n|); - - { - my $x = Math::BigInt -> new($x_str); - my $mant_got = $x -> sparts(); - - isa_ok($mant_got, "Math::BigInt"); - - is($mant_got, $mant_str, "value of mantissa"); - is($x, $x_str, "input is unmodified"); - } - -} - -# Verify that the accuracy of the significand and the exponent depends on the -# accuracy of the invocand, if set, not the class. - -note(qq|\nVerify that accuracy depends on invocand, not class.\n\n|); - -{ - Math::BigInt -> accuracy(20); - my $x = Math::BigInt -> new("3"); # accuracy is 20 - $x -> accuracy(10); # reduce accuracy to 10 - - my ($mant, $expo) = $x -> sparts(); - cmp_ok($mant, '==', 3, "value of significand"); - cmp_ok($expo, '==', 0, "value of exponent"); - cmp_ok($mant -> accuracy(), '==', 10, "accuracy of significand"); - cmp_ok($expo -> accuracy(), '==', 20, "accuracy of exponent"); -} - -note(qq|\nVerify that precision depends on invocand, not class.\n\n|); - -{ - Math::BigInt -> precision(20); - my $x = Math::BigInt -> new("3"); # precision is 20 - $x -> precision(10); # reduce precision to 10 - - my ($mant, $expo) = $x -> sparts(); - cmp_ok($mant, '==', 3, "value of significand"); - cmp_ok($expo, '==', 0, "value of exponent"); - cmp_ok($mant -> precision(), '==', 10, "precision of significand"); - cmp_ok($expo -> precision(), '==', 20, "precision of exponent"); -} - -__DATA__ - -NaN:NaN:NaN - -inf:inf:inf --inf:-inf:inf - -0:0:0 - -# positive numbers - -1:1:0 -10:1:1 -100:1:2 -1000:1:3 -10000:1:4 -100000:1:5 -1000000:1:6 -10000000:1:7 -100000000:1:8 -1000000000:1:9 -10000000000:1:10 -100000000000:1:11 -1000000000000:1:12 - -12:12:0 -120:12:1 -1200:12:2 -12000:12:3 -120000:12:4 -1200000:12:5 -12000000:12:6 -120000000:12:7 -1200000000:12:8 -12000000000:12:9 -120000000000:12:10 -1200000000000:12:11 - -123:123:0 -1230:123:1 -12300:123:2 -123000:123:3 -1230000:123:4 -12300000:123:5 -123000000:123:6 -1230000000:123:7 -12300000000:123:8 -123000000000:123:9 -1230000000000:123:10 - -1234:1234:0 -12340:1234:1 -123400:1234:2 -1234000:1234:3 -12340000:1234:4 -123400000:1234:5 -1234000000:1234:6 -12340000000:1234:7 -123400000000:1234:8 -1234000000000:1234:9 - -3141592:3141592:0 - -# negativ: numbers - --1:-1:0 --10:-1:1 --100:-1:2 --1000:-1:3 --10000:-1:4 --100000:-1:5 --1000000:-1:6 --10000000:-1:7 --100000000:-1:8 --1000000000:-1:9 --10000000000:-1:10 --100000000000:-1:11 --1000000000000:-1:12 - --12:-12:0 --120:-12:1 --1200:-12:2 --12000:-12:3 --120000:-12:4 --1200000:-12:5 --12000000:-12:6 --120000000:-12:7 --1200000000:-12:8 --12000000000:-12:9 --120000000000:-12:10 --1200000000000:-12:11 - --123:-123:0 --1230:-123:1 --12300:-123:2 --123000:-123:3 --1230000:-123:4 --12300000:-123:5 --123000000:-123:6 --1230000000:-123:7 --12300000000:-123:8 --123000000000:-123:9 --1230000000000:-123:10 - --1234:-1234:0 --12340:-1234:1 --123400:-1234:2 --1234000:-1234:3 --12340000:-1234:4 --123400000:-1234:5 --1234000000:-1234:6 --12340000000:-1234:7 --123400000000:-1234:8 --1234000000000:-1234:9 - --3141592:-3141592:0 diff --git a/cpan/Math-BigInt/t/sub_mbf.t b/cpan/Math-BigInt/t/sub_mbf.t index cf2788ea6b..242b947816 100644 --- a/cpan/Math-BigInt/t/sub_mbf.t +++ b/cpan/Math-BigInt/t/sub_mbf.t @@ -25,7 +25,7 @@ is($ms->{_custom}, 1, '$ms has custom attribute \$ms->{_custom}'); # Check that subclass is a Math::BigFloat, but not a Math::Bigint isa_ok($ms, 'Math::BigFloat'); ok(!$ms->isa('Math::BigInt'), - "An object of class '" . ref($ms) . "' isn't a 'Math::BigFloat'"); + "An object of class '" . ref($ms) . "' isn't a 'Math::BigInt'"); use Math::BigFloat; diff --git a/cpan/Math-BigInt/t/sub_mbi.t b/cpan/Math-BigInt/t/sub_mbi.t index d4553e8e5b..10fffd1f06 100644 --- a/cpan/Math-BigInt/t/sub_mbi.t +++ b/cpan/Math-BigInt/t/sub_mbi.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4280 # tests in require'd file +use Test::More tests => 4278 # tests in require'd file + 7; # tests in this file use lib 't'; diff --git a/cpan/Math-BigInt/t/to_base-mbi.t b/cpan/Math-BigInt/t/to_base-mbi.t deleted file mode 100644 index 61f2ae7850..0000000000 --- a/cpan/Math-BigInt/t/to_base-mbi.t +++ /dev/null @@ -1,100 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 30; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -while (<DATA>) { - s/#.*$//; # remove comments - s/\s+$//; # remove trailing whitespace - next unless length; # skip empty lines - - my @in = split /:/; - my $out = pop @in; - - my ($x, $xo, $y); - my $test = qq|\$x = $class -> new("$in[0]");|; - $test .= qq| \$xo = \$x -> copy();|; - $test .= qq| \$y = \$x -> to_base($in[1]|; - $test .= qq|, "$in[2]"| if @in == 3; - $test .= qq|);|; - - eval $test; - #die $@ if $@; # this should never happen - die "\nThe following test died when eval()'ed. This indicates a ", - "broken test\n\n $test\n\nThe error message was\n\n $@\n" - if $@; - - subtest $test, sub { - plan tests => 2, - - is($x, $xo, "invocand object was not changed"); - is($y, $out, 'output arg has the right value'); - }; -} - -__END__ - -# Base 2 - -0:2:0 -1:2:1 -2:2:10 -0:2:ab:a -1:2:ab:b -2:2:ab:ba - -250:2:11111010 -250:2:01:11111010 - -# Base 8 - -250:8:372 -250:8:01234567:372 - -# Base 10 (in the last case, use a truncted collation sequence that does not -# include unused characters) - -250:10:250 -250:10:0123456789:250 -250:10:012345:250 - -# Base 16 - -250:16:FA -250:16:0123456789abcdef:fa -250:16:0123456789abcdef:fa - -# Base 3 - -250:3:100021 -250:3:012:100021 - -15:3:-/|:/|- - -# Base 4 - -250:4:3322 -250:4:0123:3322 - -# Base 5 - -250:5:2000 -250:5:01234:2000 -250:5:abcde:caaa - -# Other bases - -250:36:6Y - -250:37:6S - -16:3:121 -44027:36:XYZ -125734:62:Why diff --git a/cpan/Math-BigInt/t/to_base_num-mbi.t b/cpan/Math-BigInt/t/to_base_num-mbi.t deleted file mode 100644 index 821aefb896..0000000000 --- a/cpan/Math-BigInt/t/to_base_num-mbi.t +++ /dev/null @@ -1,63 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 14; - -my $class; - -BEGIN { $class = 'Math::BigInt'; } -BEGIN { use_ok($class); } - -# For simplicity, we use the same data in the test programs for to_base_num() and -# from_base_num(). - -my @data = - ( - [ 0, 2, [ 0 ] ], - [ 1, 2, [ 1 ] ], - [ 2, 2, [ 1, 0 ] ], - [ 3, 2, [ 1, 1, ] ], - [ 4, 2, [ 1, 0, 0 ] ], - - [ 0, 10, [ 0 ] ], - [ 1, 10, [ 1 ] ], - [ 12, 10, [ 1, 2 ] ], - [ 123, 10, [ 1, 2, 3 ] ], - [ 1230, 10, [ 1, 2, 3, 0 ] ], - - [ "123456789", 100, [ 1, 23, 45, 67, 89 ] ], - - [ "1234567890" x 3, - "987654321", - [ "128", "142745769", "763888804", "574845669" ]], - - [ "1234567890" x 5, - "987654321" x 3, - [ "12499999874843750102814", "447551941015330718793208596" ]], - ); - -for (my $i = 0 ; $i <= $#data ; ++ $i) { - my @in = ($data[$i][0], $data[$i][1]); - my $out = $data[$i][2]; - - my ($x, $xo, $y); - my $test = qq|\$x = $class -> new("$in[0]");|; - $test .= qq| \$xo = \$x -> copy();|; - $test .= qq| \$y = \$x -> to_base_num("$in[1]")|; - - eval $test; - die "\nThe following test died when eval()'ed. This indicates a ", - "broken test\n\n $test\n\nThe error message was\n\n $@\n" - if $@; - - subtest $test, sub { - plan tests => 4, - - is($x, $xo, "invocand object was not changed"); - is(ref($y), 'ARRAY', "output arg is an ARRAY ref"); - ok(! grep(ref() ne $class, @$y), "every array element is a $class"); - is_deeply($y, $out, 'every array element has the right value'); - }; -} diff --git a/cpan/Math-BigInt/t/to_ieee754-mbf.t b/cpan/Math-BigInt/t/to_ieee754-mbf.t deleted file mode 100644 index 9dbfa092cb..0000000000 --- a/cpan/Math-BigInt/t/to_ieee754-mbf.t +++ /dev/null @@ -1,303 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 66; - -use Math::BigFloat; - -my @k = (16, 32, 64, 128); - -sub stringify { - my $x = shift; - return "$x" unless $x -> is_finite(); - my $nstr = $x -> bnstr(); - my $sstr = $x -> bsstr(); - return length($nstr) < length($sstr) ? $nstr : $sstr; -} - -for my $k (@k) { - - # Parameters specific to this format: - - my $b = 2; - my $p = $k == 16 ? 11 - : $k == 32 ? 24 - : $k == 64 ? 53 - : $k - sprintf("%.0f", 4 * log($k)/log(2)) + 13; - - $b = Math::BigFloat -> new($b); - $k = Math::BigFloat -> new($k); - $p = Math::BigFloat -> new($p); - my $w = $k - $p; - - my $emax = 2 ** ($w - 1) - 1; - my $emin = 1 - $emax; - - my $format = 'binary' . $k; - - note("\nComputing test data for k = $k ...\n\n"); - - my $binv = Math::BigFloat -> new("0.5"); - - my $data = - [ - - { - dsc => "smallest positive subnormal number", - bin => "0" - . ("0" x $w) - . ("0" x ($p - 2)) . "1", - asc => "$b ** ($emin) * $b ** (" . (1 - $p) . ") " - . "= $b ** (" . ($emin + 1 - $p) . ")", - mbf => $binv ** ($p - 1 - $emin), - }, - - { - dsc => "largest subnormal number", - bin => "0" - . ("0" x $w) - . ("1" x ($p - 1)), - asc => "$b ** ($emin) * (1 - $b ** (" . (1 - $p) . "))", - mbf => $binv ** (-$emin) * (1 - $binv ** ($p - 1)), - }, - - { - dsc => "smallest positive normal number", - bin => "0" - . ("0" x ($w - 1)) . "1" - . ("0" x ($p - 1)), - asc => "$b ** ($emin)", - mbf => $binv ** (-$emin), - }, - - { - dsc => "largest normal number", - bin => "0" - . ("1" x ($w - 1)) . "0" - . "1" x ($p - 1), - asc => "$b ** $emax * ($b - $b ** (" . (1 - $p) . "))", - mbf => $b ** $emax * ($b - $binv ** ($p - 1)), - }, - - { - dsc => "largest number less than one", - bin => "0" - . "0" . ("1" x ($w - 2)) . "0" - . "1" x ($p - 1), - asc => "1 - $b ** (-$p)", - mbf => 1 - $binv ** $p, - }, - - { - dsc => "smallest number larger than one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . ("0" x ($p - 2)) . "1", - asc => "1 + $b ** (" . (1 - $p) . ")", - mbf => 1 + $binv ** ($p - 1), - }, - - { - dsc => "second smallest number larger than one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . ("0" x ($p - 3)) . "10", - asc => "1 + $b ** (" . (2 - $p) . ")", - mbf => 1 + $binv ** ($p - 2), - }, - - { - dsc => "one", - bin => "0" - . "0" . ("1" x ($w - 1)) - . "0" x ($p - 1), - asc => "1", - mbf => Math::BigFloat -> new("1"), - }, - - { - dsc => "minus one", - bin => "1" - . "0" . ("1" x ($w - 1)) - . "0" x ($p - 1), - asc => "-1", - mbf => Math::BigFloat -> new("-1"), - }, - - { - dsc => "two", - bin => "0" - . "1" . ("0" x ($w - 1)) - . ("0" x ($p - 1)), - asc => "2", - mbf => Math::BigFloat -> new("2"), - }, - - { - dsc => "minus two", - bin => "1" - . "1" . ("0" x ($w - 1)) - . ("0" x ($p - 1)), - asc => "-2", - mbf => Math::BigFloat -> new("-2"), - }, - - { - dsc => "positive zero", - bin => "0" - . ("0" x $w) - . ("0" x ($p - 1)), - asc => "+0", - mbf => Math::BigFloat -> new("0"), - }, - - { - dsc => "positive infinity", - bin => "0" - . ("1" x $w) - . ("0" x ($p - 1)), - asc => "+inf", - mbf => Math::BigFloat -> new("inf"), - }, - - { - dsc => "negative infinity", - bin => "1" - . ("1" x $w) - . ("0" x ($p - 1)), - asc => "-inf", - mbf => Math::BigFloat -> new("-inf"), - }, - - { - dsc => "NaN (encoding used by Perl on Cygwin)", - bin => "1" - . ("1" x $w) - . ("1" . ("0" x ($p - 2))), - asc => "NaN", - mbf => Math::BigFloat -> new("NaN"), - }, - - ]; - - for my $entry (@$data) { - my $bin = $entry -> {bin}; - my $bytes = pack "B*", $bin; - my $hex = unpack "H*", $bytes; - - note("\n", $entry -> {dsc}, " (k = $k): ", $entry -> {asc}, "\n\n"); - - my $x = $entry -> {mbf}; - - my $test = qq|Math::BigFloat -> new("| . stringify($x) - . qq|") -> to_ieee754("$format")|; - - my $got_bytes = $x -> to_ieee754($format); - my $got_hex = unpack "H*", $got_bytes; - $got_hex =~ s/(..)/\\x$1/g; - - my $expected_hex = $hex; - $expected_hex =~ s/(..)/\\x$1/g; - - is($got_hex, $expected_hex); - } -} - -# These tests verify fixing CPAN RT #139960. - -# binary16 - -{ - # largest subnormal number - my $lo = Math::BigFloat -> from_ieee754("03ff", "binary16"); - - # smallest normal number - my $hi = Math::BigFloat -> from_ieee754("0400", "binary16"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary16"); - is($got, "0400", - "6.102025508880615234375e-5 -> 0x0400"); -} - -{ - # largest number smaller than one - my $lo = Math::BigFloat -> from_ieee754("3bff", "binary16"); - - # one - my $hi = Math::BigFloat -> from_ieee754("3c00", "binary16"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary16"); - is($got, "3c00", "9.998779296875e-1 -> 0x3c00"); -} - -# binary32 - -{ - # largest subnormal number - my $lo = Math::BigFloat -> from_ieee754("007fffff", "binary32"); - - # smallest normal number - my $hi = Math::BigFloat -> from_ieee754("00800000", "binary32"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary32"); - is($got, "00800000", - "1.1754943157898258998483097641290060955707622747...e-38 -> 0x00800000"); -} - -{ - # largest number smaller than one - my $lo = Math::BigFloat -> from_ieee754("3f7fffff", "binary32"); - - # one - my $hi = Math::BigFloat -> from_ieee754("3f800000", "binary32"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary32"); - is($got, "3f800000", - "9.9999998509883880615234375e-1 -> 0x3f800000"); -} - -# binary64 - -{ - # largest subnormal number - my $lo = Math::BigFloat -> from_ieee754("000fffffffffffff", "binary64"); - - # smallest normal number - my $hi = Math::BigFloat -> from_ieee754("0010000000000000", "binary64"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary64"); - is($got, "0010000000000000", - "2.2250738585072012595738212570207680200...e-308 -> 0x0010000000000000"); -} - -{ - # largest number smaller than one - my $lo = Math::BigFloat -> from_ieee754("3fefffffffffffff", "binary64"); - - # one - my $hi = Math::BigFloat -> from_ieee754("3ff0000000000000", "binary64"); - - # compute an average weighted towards the larger of the two - my $x = 0.25 * $lo + 0.75 * $hi; - - my $got = unpack "H*", $x -> to_ieee754("binary64"); - is($got, "3ff0000000000000", - "9.999999999999999722444243843710864894092...e-1 -> 0x3ff0000000000000"); -} diff --git a/cpan/Math-BigInt/t/upgrade.inc b/cpan/Math-BigInt/t/upgrade.inc index 3cef71108d..d8bd119086 100644 --- a/cpan/Math-BigInt/t/upgrade.inc +++ b/cpan/Math-BigInt/t/upgrade.inc @@ -25,7 +25,7 @@ our ($CLASS, $LIB, $EXPECTED_CLASS); package Math::Foo; use Math::BigInt lib => $main::LIB; -our @ISA = (qw/Math::BigInt/); +our @ISA = ('Math::BigInt'); use overload # customized overload for sub, since original does not use swap there @@ -573,7 +573,7 @@ boneNaN:+:1 &binf 1:+:inf 2:-:-inf -3:abc:inf +3:+inf:inf &is_nan 123:0 @@ -620,14 +620,14 @@ abc:abc:NaN -1234:0:10:-1234 +1234:0:10:1234 +200:2:10:2 -+1234:3:10:1 -+1234:2:10:12 ++1234:3:10:1.234 ++1234:2:10:12.34 +1234:-3:10:NaN 310000:4:10:31 12300000:5:10:123 1230000000000:10:10:123 -09876123456789067890:12:10:9876123 -1234561234567890123:13:10:123456 +09876123456789067890:12:10:9876123.45678906789 +1234561234567890123:13:10:123456.1234567890123 &bsstr 1e+34:1e+34 diff --git a/cpan/Math-BigInt/t/upgrade.t b/cpan/Math-BigInt/t/upgrade.t index 94f7e8a0dc..132c9c5e9d 100644 --- a/cpan/Math-BigInt/t/upgrade.t +++ b/cpan/Math-BigInt/t/upgrade.t @@ -33,8 +33,8 @@ $EXPECTED_CLASS = "Math::BigFloat"; $LIB = "Math::BigInt::Calc"; # backend is(Math::BigInt->upgrade(), "Math::BigFloat", - qq/Math::BigInt->upgrade()/); -is(Math::BigInt->downgrade() || "", "", - qq/Math::BigInt->downgrade() || ""/); + "Math::BigInt->upgrade()"); +is(Math::BigInt->downgrade(), undef, + "Math::BigInt->downgrade()"); require './t/upgrade.inc'; # all tests here for sharing diff --git a/cpan/Math-BigInt/t/upgrade2.t b/cpan/Math-BigInt/t/upgrade2.t index 8b8c03691d..28ecdbb50b 100644 --- a/cpan/Math-BigInt/t/upgrade2.t +++ b/cpan/Math-BigInt/t/upgrade2.t @@ -12,6 +12,7 @@ use Math::BigFloat upgrade => 'Math::BigMouse'; no warnings 'once'; @Math::BigMouse::ISA = 'Math::BigFloat'; +sub Math::BigMouse::bsqrt {}; () = sqrt Math::BigInt->new(2); pass('sqrt on a big int does not segv if there are 2 upgrade levels'); |