On Sat, Dec 02, 2000 at 06:34:26PM +0000, Nicholas Clark wrote: > On Tue, Nov 14, 2000 at 10:30:06AM -0600, Jarkko Hietaniemi wrote: > > > OK. What does a scalar with IV and NV both OK mean? > > > > I *think* it *should* mean that the cached IV and NV are both valid > > *and* that there is no loss of precision: (IV)nv == iv && (NV)iv == nv. > > Obviously, this doesn't seem to be the case. > > OK. How do I detect that 18446744073709551616.0 isn't 18446744073709551615 ? > > Round here: > > #include <stdio.h> > int main (void) { > unsigned long long max=0xFFFFFFFFFFFFFFFF; > double imprecision; > > imprecision = (double) max; > printf ("imprecision=%.1f\tmax=%llu\n", imprecision, max); > if (imprecision == ((double) max)) > puts ("imprecision == (double) max"); > if (((unsigned long long) imprecision) == max) > puts ("(unsigned long long) imprecision == max"); > return 0; > } > > Gives: > > imprecision=18446744073709551616.0 max=18446744073709551615 > imprecision == (double) max > (unsigned long long) imprecision == max In alpha where sizeof(long long) == sizeof(long) == sizeof(double) == 8: imprecision=18446744073709552000.0 max=lu imprecision == (double) max You can see how the low order bits fade into garbage... (btw, fwiw, long long is still thought to be a non std language extension, so in the actual test we should use UV) > How do I detect that the UV and the NV aren't equal, when all the casting > conspires to keep it from me? xor the UV low bits with something and see > if that also is preserved? > [I *think* that this only happens on UV_MAX, and that we need can detect > if the platform needs this double test during Configure] > > Nicholas Clark -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack CohenThread Previous | Thread Next