How can I indentify an NaN value with the JSRT APIs?
JsGetValueType returns JsNumber (which seems to be consistent with the expected behavior for "typeof NaN"), and JsNumberToInt returns 0. So, I'm having trouble distinguishing between NaN and a valid number.
I guess maybe I just have to call isNan()?
Have you tried JsNumberToDouble()? I believe it should return a standard double NaN value. Alternately you could call Number.isNaN.
I think you can use the JsStrictEquals API https://github.com/Microsoft/ChakraCore/wiki/JsStrictEquals
As NaN is the one value in Js which does not equal itself:
const val = NaN;
print(val === val); // prints false
From JSRT, I think JsStrictEquals is probably the most straightforward, though you should probably comment it since checking for x === x isnt particularly clear :)
Most helpful comment
I think you can use the JsStrictEquals API https://github.com/Microsoft/ChakraCore/wiki/JsStrictEquals
As NaN is the one value in Js which does not equal itself:
const val = NaN;
print(val === val); // prints false