|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>|
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.
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";