I'm planning to test a cross-platform SIMD library in more detail.
As part of that, I'd like to make sure I test a lot of the corner cases of floating point numbers for consistent behavior.
I can only come up with a few, like
- zero and negative zero,
- the positive and negative infinites,
- multiple versions of NaN,
- denormalized numbers
Now, especially the last two points give me headaches: I'm not even sure I understand the binary representation of what makes a (32b) float a NaN, much less the distinction between the different types (it seems there's three of these, quiet, signalling and "plain" NaN, but I'm really not sure they've got their own representation).
Also, denormalized numbers are exponent-all-zero, mantissa non-zero.
Is there a way of programmatically generating all these special numbers (Ok, +zero is easy, just interpret a 32bit 0-int to float)? I'm working on a C(99) and C++(11) library, so either one would be fine.
Aucun commentaire:
Enregistrer un commentaire