diff options
Diffstat (limited to 'lib/Math')
-rw-r--r-- | lib/Math/BigFloat.pm | 13 | ||||
-rw-r--r-- | lib/Math/BigInt.pm | 2 | ||||
-rw-r--r-- | lib/Math/BigInt/Calc.pm | 4 | ||||
-rw-r--r-- | lib/Math/BigInt/t/bare_mbf.t | 2 | ||||
-rw-r--r-- | lib/Math/BigInt/t/bigfltpm.inc | 34 | ||||
-rwxr-xr-x | lib/Math/BigInt/t/bigfltpm.t | 2 | ||||
-rwxr-xr-x | lib/Math/BigInt/t/sub_mbf.t | 2 | ||||
-rw-r--r-- | lib/Math/BigInt/t/with_sub.t | 2 |
8 files changed, 35 insertions, 26 deletions
diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm index dcd0d351eb..42eb77c91d 100644 --- a/lib/Math/BigFloat.pm +++ b/lib/Math/BigFloat.pm @@ -12,7 +12,7 @@ package Math::BigFloat; # _a : accuracy # _p : precision -$VERSION = '1.45'; +$VERSION = '1.46'; require 5.005; require Exporter; @@ -745,7 +745,16 @@ sub blog return $x->bnan() if $base->is_zero() || $base->is_one() || $base->{sign} ne '+'; # if $x == $base, we know the result must be 1.0 - return $x->bone('+',@params) if $x->bcmp($base) == 0; + if ($x->bcmp($base) == 0) + { + $x->bone('+',@params); + if ($fallback) + { + # clear a/p after round, since user did not request it + delete $x->{_a}; delete $x->{_p}; + } + return $x; + } } # when user set globals, they would interfere with our calculation, so diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm index 25fb8f8111..b84ad36436 100644 --- a/lib/Math/BigInt.pm +++ b/lib/Math/BigInt.pm @@ -18,7 +18,7 @@ package Math::BigInt; my $class = "Math::BigInt"; require 5.005; -$VERSION = '1.71'; +$VERSION = '1.72'; use Exporter; @ISA = qw( Exporter ); @EXPORT_OK = qw( objectify bgcd blcm); diff --git a/lib/Math/BigInt/Calc.pm b/lib/Math/BigInt/Calc.pm index f2bcc92655..a4a1002d4f 100644 --- a/lib/Math/BigInt/Calc.pm +++ b/lib/Math/BigInt/Calc.pm @@ -6,7 +6,7 @@ use strict; use vars qw/$VERSION/; -$VERSION = '0.41'; +$VERSION = '0.42'; # Package to store unsigned big integers in decimal and do math with them @@ -1151,7 +1151,7 @@ sub _rsft my $dst = 0; # destination my $src = _num($c,$y); # as normal int my $xlen = (@$x-1)*$BASE_LEN+length(int($x->[-1])); # len of x in digits - if ($src > $xlen or ($src == $xlen and ! defined $x->[1])) + if ($src >= $xlen or ($src == $xlen and ! defined $x->[1])) { # 12345 67890 shifted right by more than 10 digits => 0 splice (@$x,1); # leave only one element diff --git a/lib/Math/BigInt/t/bare_mbf.t b/lib/Math/BigInt/t/bare_mbf.t index 999604c0e8..cdf0f8ff5b 100644 --- a/lib/Math/BigInt/t/bare_mbf.t +++ b/lib/Math/BigInt/t/bare_mbf.t @@ -27,7 +27,7 @@ BEGIN } print "# INC = @INC\n"; - plan tests => 1837; + plan tests => 1861; } use Math::BigFloat lib => 'BareCalc'; diff --git a/lib/Math/BigInt/t/bigfltpm.inc b/lib/Math/BigInt/t/bigfltpm.inc index 8a621f7c69..c978644d9d 100644 --- a/lib/Math/BigInt/t/bigfltpm.inc +++ b/lib/Math/BigInt/t/bigfltpm.inc @@ -74,7 +74,7 @@ while (<DATA>) } elsif ($f eq "ffac") { $try .= "$setup; \$x->ffac();"; } elsif ($f eq "flog") { - if ($args[1] ne '') + if (defined $args[1] && $args[1] ne '') { $try .= "\$y = $class->new($args[1]);"; $try .= "$setup; \$x->flog(\$y);"; @@ -327,22 +327,22 @@ $div_scale = 40; 1::0 1:1:0 1:2:0 -# this is too slow for the testsuite -#2:0.6931471805599453094172321214581765680755 -#2.718281828:0.9999999998311266953289851340574956564911 -#$div_scale = 20; -#2.718281828:0.99999999983112669533 -# too slow, too -#123:4.8112184355 -$div_scale = 14; -#10:0:2.302585092994 -#1000:0:6.90775527898214 -#100:0:4.60517018598809 -2::0.69314718055995 -#3.1415:0:1.14470039286086 -# too slow -#12345:0:9.42100640177928 -#0.001:0:-6.90775527898214 +2::0.6931471805599453094172321214581765680755 +2.718281828::0.9999999998311266953289851340574956564911 +$div_scale = 20; +2.718281828::0.99999999983112669533 +$div_scale = 15; +123::4.81218435537242 +10::2.30258509299405 +1000::6.90775527898214 +100::4.60517018598809 +2::0.693147180559945 +3.1415::1.14470039286086 +12345::9.42100640177928 +0.001::-6.90775527898214 +# bug until v1.71: +10:10:1 +100:100:1 # reset for further tests $div_scale = 40; 1::0 diff --git a/lib/Math/BigInt/t/bigfltpm.t b/lib/Math/BigInt/t/bigfltpm.t index dbad294993..331621c088 100755 --- a/lib/Math/BigInt/t/bigfltpm.t +++ b/lib/Math/BigInt/t/bigfltpm.t @@ -26,7 +26,7 @@ BEGIN } print "# INC = @INC\n"; - plan tests => 1837 + plan tests => 1861 + 2; # own tests } diff --git a/lib/Math/BigInt/t/sub_mbf.t b/lib/Math/BigInt/t/sub_mbf.t index bdae6a513f..0dae63ea4d 100755 --- a/lib/Math/BigInt/t/sub_mbf.t +++ b/lib/Math/BigInt/t/sub_mbf.t @@ -26,7 +26,7 @@ BEGIN } print "# INC = @INC\n"; - plan tests => 1837 + plan tests => 1861 + 6; # + our own tests } diff --git a/lib/Math/BigInt/t/with_sub.t b/lib/Math/BigInt/t/with_sub.t index af00563c15..f34b88758b 100644 --- a/lib/Math/BigInt/t/with_sub.t +++ b/lib/Math/BigInt/t/with_sub.t @@ -28,7 +28,7 @@ BEGIN } print "# INC = @INC\n"; - plan tests => 1837 + plan tests => 1861 + 1; } |