On Wed, Jun 27, 2001 at 04:24:01PM +0100, Mike Guy wrote: > Nicholas Clark <nick@ccl4.org> wrote > > On Mon, Jun 25, 2001 at 05:27:44PM -0500, Jarkko Hietaniemi wrote: > > > NV = 4745162525730 > > > NV = 4745162525730 > > > > This is crazy. They appear to be the same. > > Not necessarily. Sneaky stuff, float-to-string conversion. Watch: > If you want to know reliably the value of an NV, you have to look at more > that its printed form. If you know a quantity which is near to the > expected value, and which is exactly representable, the simplest > trick is to display the difference from that quantity, e.g. > displaying $y-4745162525730 in the above example. Good point. What does the nasty AIX configuration make of: #!/usr/bin/perl -w $x = 4745162525730; $y = int(279964589018079/59); if ($y == $x) { print "ok 13\n" } else { print "not ok 13 # int(279964589018079/59) is $y, not $x\n"; } use Devel::Peek; Dump($x); Dump($y); Dump($y-4745162525730); #!/usr/bin/perl -w $x = 4745162525730; $y = int(279964589018079/59); if ($x == $y) { print "ok 13\n" } else { print "not ok 13 # int(279964589018079/59) is $y, not $x\n"; } use Devel::Peek; Dump($x); Dump($y); Dump($y-4745162525730); I get 0 for the last dumps Nicholas ClarkThread Previous | Thread Next