From: Tels Date: Fri, 13 Aug 2004 14:02:50 +0000 (+0200) Subject: pre Math::BigInt v1.72 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=90d1b12917c6df69d793f0c9dc8d5cbfacf97955;p=p5sagit%2Fp5-mst-13.2.git pre Math::BigInt v1.72 Message-Id: <200408131402.52270@bloodgate.com> p4raw-id: //depot/perl@23216 --- diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm index dcd0d35..42eb77c 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 25fb8f8..b84ad36 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 f2bcc92..a4a1002 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 999604c..cdf0f8f 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 8a621f7..c978644 100644 --- a/lib/Math/BigInt/t/bigfltpm.inc +++ b/lib/Math/BigInt/t/bigfltpm.inc @@ -74,7 +74,7 @@ while () } 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 dbad294..331621c 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 bdae6a5..0dae63e 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 af00563..f34b887 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; }