News for hackers. Stuff that matters.
Re:One does not simply calculate the absolute value by HWR_14 on Monday August 23, 2021 @11:25AM (#28277274)
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.

Re:One does not simply calculate the absolute value by Dylan16807 on Monday August 23, 2021 @03:54PM (#28281094)
To 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.