# _a : accuracy
# _p : precision
-$VERSION = '1.45';
+$VERSION = '1.46';
require 5.005;
require Exporter;
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
my $class = "Math::BigInt";
require 5.005;
-$VERSION = '1.71';
+$VERSION = '1.72';
use Exporter;
@ISA = qw( Exporter );
@EXPORT_OK = qw( objectify bgcd blcm);
use vars qw/$VERSION/;
-$VERSION = '0.41';
+$VERSION = '0.42';
# Package to store unsigned big integers in decimal and do math with them
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
}
print "# INC = @INC\n";
- plan tests => 1837;
+ plan tests => 1861;
}
use Math::BigFloat lib => 'BareCalc';
} 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);";
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
}
print "# INC = @INC\n";
- plan tests => 1837
+ plan tests => 1861
+ 2; # own tests
}
}
print "# INC = @INC\n";
- plan tests => 1837
+ plan tests => 1861
+ 6; # + our own tests
}
}
print "# INC = @INC\n";
- plan tests => 1837
+ plan tests => 1861
+ 1;
}