@ISA = qw(Math::BigFloat);
-$VERSION = '0.2602';
+$VERSION = '0.2603';
$VERSION = eval $VERSION;
# inherit overload from Math::BigFloat, but disable the bitwise ops that don't
return Math::BigInt->new($x->{sign}) if $x->{sign} !~ /^[+-]$/;
my $u = Math::BigInt->bzero();
- $u->{sign} = $x->{sign};
$u->{value} = $MBI->_div( $MBI->_copy($x->{_n}), $x->{_d}); # 22/7 => 3
+ $u->bneg if $x->{sign} eq '-'; # no negative zero
$u;
}
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 200;
+use Test::More tests => 202;
# basic testing of Math::BigRat
is ($f, '0.66667', 'as_float(2/3,5)');
##############################################################################
+# int()
+
+$x = Math::BigRat->new('5/2');
+is int($x), '2', '5/2 converted to integer';
+$x = Math::BigRat->new('-1/2');
+is int($x), '0', '-1/2 converted to integer';
+
+##############################################################################
# done
1;
Resolved an issue where C<unzip> executable was present in C<PATH> on MSWin32
+=item *
+
+L<Math::BigRat> has been upgraded from version 0.2602 to 0.2603.
+
+C<int()> on a Math::BigRat object containing -1/2 now creates a
+Math::BigInt containing 0, rather than -0. L<Math::BigInt> does not even
+support negative zero, so the resulting object was actually malformed
+[perl #95530].
+
=back
=head2 Removed Modules and Pragmata