|Subject:||BigFloat overloaded int() changing its input|
|Date:||Tue, 26 Apr 2016 16:37:06 +1000|
|To:||bug-Math-BigInt [...] rt.cpan.org|
|From:||Kevin Ryde <user42_kevin [...] yahoo.com.au>|
With Math-BigInt 1.999719 on recent debian i386 perl 5.22.1, a program use strict; use Math::BigFloat; my $x = Math::BigFloat->new('0.5'); print "x is $x\n"; my $i = int($x); print "i is $i and x is now $x\n"; prints x is 0.5 i is 0 and x is now 0 I hoped int($x) would return a rounded value and leave its input $x unchanged. That being of course is how int() behaves on ordinary scalars, and I believe how previous BigFloat behaved too. This is per a report from Slaven Rezic on tests of some of my code failingand noting there the problem seems tickled by the immediately previous BigFloat 1.999718 in addition to 1.999719.