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: DB<1> $x = 4745162525730; $y = $x + 2**-10 DB<2> Dump $x; Dump $y; Dump $y-$x; SV = NV(0x115fc0) at 0x24a68c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 4745162525730 SV = NV(0x115fd0) at 0x24a6b0 REFCNT = 1 FLAGS = (NOK,pNOK) NV = 4745162525730 SV = NV(0x115fc0) at 0x24a7f4 REFCNT = 1 FLAGS = (PADTMP,NOK,pNOK) NV = 0.0009765625 DB<3> 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. Mike GuyThread Previous | Thread Next