summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/Math-BigInt/lib/Math/BigFloat.pm7
-rw-r--r--dist/Math-BigInt/t/bare_mbf.t2
-rw-r--r--dist/Math-BigInt/t/bigfltpm.inc2
-rw-r--r--dist/Math-BigInt/t/bigfltpm.t2
-rw-r--r--dist/Math-BigInt/t/sub_mbf.t2
-rw-r--r--dist/Math-BigInt/t/with_sub.t2
6 files changed, 12 insertions, 5 deletions
diff --git a/dist/Math-BigInt/lib/Math/BigFloat.pm b/dist/Math-BigInt/lib/Math/BigFloat.pm
index 2f5753f824..a423b35f02 100644
--- a/dist/Math-BigInt/lib/Math/BigFloat.pm
+++ b/dist/Math-BigInt/lib/Math/BigFloat.pm
@@ -3528,7 +3528,11 @@ sub bceil
$x->{_m} = $MBI->_rsft($x->{_m},$x->{_e},10); # cut off digits after dot
$x->{_e} = $MBI->_zero(); # trunc/norm
$x->{_es} = '+'; # abs e
- $MBI->_inc($x->{_m}) if $x->{sign} eq '+'; # increment if positive
+ if ($x->{sign} eq '+') {
+ $MBI->_inc($x->{_m}); # increment if positive
+ } else {
+ $x->{sign} = '+' if $MBI->_is_zero($x->{_m}); # avoid -0
+ }
}
$x->round($a,$p,$r);
}
@@ -3547,6 +3551,7 @@ sub bint
$x->{_m} = $MBI->_rsft($x->{_m},$x->{_e},10); # cut off digits after dot
$x->{_e} = $MBI->_zero(); # truncate/normalize
$x->{_es} = '+'; # abs e
+ $x->{sign} = '+' if $MBI->_is_zero($x->{_m}); # avoid -0
}
$x->round($a,$p,$r);
}
diff --git a/dist/Math-BigInt/t/bare_mbf.t b/dist/Math-BigInt/t/bare_mbf.t
index 8f3727081b..69dcc80f92 100644
--- a/dist/Math-BigInt/t/bare_mbf.t
+++ b/dist/Math-BigInt/t/bare_mbf.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2336;
+use Test::More tests => 2340;
BEGIN { unshift @INC, 't'; }
diff --git a/dist/Math-BigInt/t/bigfltpm.inc b/dist/Math-BigInt/t/bigfltpm.inc
index 2ffeafa398..3eb2e21e0d 100644
--- a/dist/Math-BigInt/t/bigfltpm.inc
+++ b/dist/Math-BigInt/t/bigfltpm.inc
@@ -1823,6 +1823,7 @@ abc:NaN
-51:-51
-51.2:-51
12.2:13
+-0.4:0
&fint
0:0
NaN:NaN
@@ -1832,3 +1833,4 @@ NaN:NaN
-51:-51
-51.2:-51
12.2:12
+-0.4:0
diff --git a/dist/Math-BigInt/t/bigfltpm.t b/dist/Math-BigInt/t/bigfltpm.t
index 6f6e598b43..8653f77ad1 100644
--- a/dist/Math-BigInt/t/bigfltpm.t
+++ b/dist/Math-BigInt/t/bigfltpm.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2336
+use Test::More tests => 2340
+ 5; # own tests
diff --git a/dist/Math-BigInt/t/sub_mbf.t b/dist/Math-BigInt/t/sub_mbf.t
index 28252b470c..fec4d0708a 100644
--- a/dist/Math-BigInt/t/sub_mbf.t
+++ b/dist/Math-BigInt/t/sub_mbf.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2336
+use Test::More tests => 2340
+ 6; # + our own tests
diff --git a/dist/Math-BigInt/t/with_sub.t b/dist/Math-BigInt/t/with_sub.t
index 48dfa3070b..d90bbbc7dd 100644
--- a/dist/Math-BigInt/t/with_sub.t
+++ b/dist/Math-BigInt/t/with_sub.t
@@ -3,7 +3,7 @@
# Test use Math::BigFloat with => 'Math::BigInt::SomeSubclass';
use strict;
-use Test::More tests => 2336 + 1;
+use Test::More tests => 2340 + 1;
use Math::BigFloat with => 'Math::BigInt::Subclass', lib => 'Calc';