4 ms·
I understand the motivation but I disagree that NaN should not equal NaN. The es docs even explicily mention that "to ECMAScript code, all NaN values are indist
by schindlabua 9y ago
I understand the motivation but I disagree that NaN should not equal NaN. The es docs even explicily mention that "to ECMAScript code, all NaN values are indistinguishable from each other."
I'm writing javascript and I don't want to need to care about IEEE 754 floating point (all I know about is `Number` anyway).
If you compare two NaNs in C that happen to have the same binary representation, they are equal. Which means that a typical javascript runtime will need to check for that case, no? So if they have to make the decision between making all NaNs equal or unequal, and there's going to be a runtime check either way, why not make NaN == NaN and save us a headache?