Thread with 17 posts

jump to expanded post
Tom Forsyth , @TomF@mastodon.gamedev.place
(open profile)

@steve @mcc @hikari On x86, you can disable throwing actual exceptions on sNaNs. The MXCSR register has "sticky" bits that you can clear before a sequence, then check afterwards. If there were any sNaNs read or produced during the sequence, the "Invalid Operation" sticky bit will be set. I believe qNaNs do not set the sticky bits.

This is rather klunky to use, and relies on the language/library having support for reading/setting the MXCSR, but it can be done.

Open remote post (opens in a new window)
Josh Simmons , @dotstdy@mastodon.social
(open profile)

@steve @mcc @hikari my favorite part is when people work hard to write explicit nan checks and handling, which then immediately get thrown away by the compiler. (which leads to a fun escalating war of detecting nan in obtuse ways, I'm sure some smartass in compiler land is going to get clever with bit patterns one day and break all the explicit via-integer checks too, this is all only in internal builds, at least, but it's a bit funny)

Open remote post (opens in a new window)