3 ms·
As an aside, I have thought recently that integers should also have NaN value, just like floating point values have. It's useful in statistics to differentiate
by js8 8y ago
As an aside, I have thought recently that integers should also have NaN value, just like floating point values have. It's useful in statistics to differentiate between not having a value and value of 0.
And I was thinking that perhaps 0x80000000 (in two's complement arithmetic) would be a good value for integer NaN. This value is already fixed point with respect to negation, so why not make it into an exception on its own right?
But it would mean to rethink all the hardware which I don't think is an option.
In any case, I think to set 1/0 to 0 is a bad idea, but I could imagine setting x/0 to 0x80000000 (interpreted as NaN) to make more sense.
- bluecalm 8y agoI like the idea of having integer NaN but I think unsigned numbers are problematic as there isn't any convenient way to encode it.