Math::BigFloat -> binf() -> as_int() returns NaN, but should return
inf. In other words, if $x is a Math::BigFloat, then $x -> as_int()
shall return the same as Math::BigInt -> new($x). The bug appears both
for +inf and -inf.
-lib/Math/BigFloat.pm: Add two lines to catch the cases when the input
is +/-inf and NaN, respectively.
-t/bare_mbf.t: incremented test count by 3
-t/bigfltpm.inc: add 3 tests, for +inf, -inf, and NaN
-t/bigfltpm.t: incremented test count by 3
-t/sub_mbf.t: incremented test count by 3
-t/with_sub.t: incremented test count by 3
$x = $x->can('as_float') ? $x->as_float() : $self->new(0+"$x");
}
+ return Math::BigInt->binf($x->sign()) if $x->is_inf();
+ return Math::BigInt->bnan() if $x->is_nan();
+
my $z = $MBI->_copy($x->{_m});
if ($x->{_es} eq '-') # < 0
{
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2316;
+use Test::More tests => 2319;
BEGIN { unshift @INC, 't'; }
-2:-2
-123.456:-123
-200:-200
+-inf:-inf
+inf:inf
+NaN:NaN
# test for bug in brsft() not handling cases that return 0
0.000641:0
0.0006412:0
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2316
+use Test::More tests => 2319
+ 5; # own tests
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 2316
+use Test::More tests => 2319
+ 6; # + our own tests
# Test use Math::BigFloat with => 'Math::BigInt::SomeSubclass';
use strict;
-use Test::More tests => 2316 + 1;
+use Test::More tests => 2319 + 1;
use Math::BigFloat with => 'Math::BigInt::Subclass', lib => 'Calc';