Skip Menu |
 

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 70244
Status: resolved
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.997



Subject: int(x) > x
Date: Sat, 13 Aug 2011 10:07:51 +1000
To: bug-Math-BigInt [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 407b
With recent debian i386 perl 5.12.4 and its Math::BigInt 1.993, it seems int($x) > $x is true for a positive BigFloat, where I expected it to be false, since int() rounds towards zero. Eg. foo.pl below. I see int() gives a BigInt but a comparision "BigInt > BigFloat" apparently doesn't like a fraction part in the second arg. Maybe it could notice a BigFloat there for maximum inter-operation.
Download foo.pl
text/x-perl 153b
use strict; use Math::BigFloat; my $f = Math::BigFloat->new('3.5'); my $i = int($f); print "f=$f\n"; print "i=$i\n"; print "i > f is '",($i > $f),"'\n";
Download (untitled) / with headers
text/plain 131b
This is fixed. The spaceship operator returns 0 for non-upgraded values, and -1 with upgrade turned on. Please close this ticket.
This was fixed in version 1.997.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.