Remix.run Logo
zahlman 2 days ago

>but apparently this is useful for some reason.

It lets you easily test whether a value is NaN without needing a library function call. (Even if the language wanted to provide a NaN literal, there's more than one NaN value, so that wouldn't actually work!)

AndriyKunitsyn 2 days ago | parent [-]

This test is better with a function call, because it clearly shows the intent. Perf-wise, this function call will be inlined by any decent compiler. https://godbolt.org/z/chhM85vP3

Breaking a basic programming expectation for a specific class of values of a specific type is not a good thing, in my opinion.