int nan

bearophile bearophileHUGS at lycos.com
Sun Jun 28 15:02:46 PDT 2009


ponce:

> What would be the NaN of uint ?

Having a NaN in just signed integral values (of 1, 2, 4, 8, 16 bytes) looks enough to me, see below.


>What if you actually need 2^32 different values (such as in a linear congruential random number generator) ?<

I agree that there are many situations where you want 2^32 different values, or 2^16, etc, in such situations you can use an utiny/ushort/uint/ulong/ucent that has no nan (and once in while you may even use a nullable uint like in C#).

But I think it's much less common to need 2^32 or 2^64 different signed integers.


>Besides, there would be no cheap way to ensure NaN propagation (no hardware support).<

I was talking about having hardware support, of course.

Bye,
bearophile



More information about the Digitalmars-d mailing list