2 ms·
If you log it, why wouldn't you just log it at creation time. Are you going to periodically scan all floating-point numbers used everywhere in your code to see
by HWR_14 5y ago
If you log it, why wouldn't you just log it at creation time. Are you going to periodically scan all floating-point numbers used everywhere in your code to see where they are created?
> The behavior that's much more useful and enshrined in the IEEE spec is that you keep the original NaN.
I didn't realize it was in the spec. I just checked, and you're right! That does however seem strange - X was never set by operation NNNN, Y was.
- Dylan16807 5y agoTo me, trying to handle exceptions every time a NaN shows up sounds like it's riskier to performance than a few checks at important places. You wouldn't scan. Probably depends on code base. > That does however seem strange - X was never set by operation NNNN, Y was. If you're using NaN payloads, it would almost never be helpful for 95% of your NaNs to turn into a generic "used a NaN in arithmetic" version.