4 ms·
NaN is a feature of dynamically typed languages; otherwise they would not be able to represent all outcomes of implicit coercion.
by eurasiantiger 5y ago
NaN is a feature of dynamically typed languages; otherwise they would not be able to represent all outcomes of implicit coercion.
- spc476 5y agoAnd here I thought NaN was a definition from IEEE-754.
- forty 5y agoYes, I'm not sure what parent means. Even java double has NaN.
- wongarsu 5y agoNaN is a feature of IEEE floats to ensure that all arithmetic operations can always create a correct result. For example 0/0 has to evaluate to NaN, no other result would be mathematically correct. If there was no NaN the CPU would have to trigger a fault or return an incorrect result, both are undesirable.
- eurasiantiger 5y agoSo, today I learned something: the JavaScript critics are wrong at yet another thing.
- LinAGKar 5y agoIt crops up more in JavaScript since it doesn't have integers, and if you try to convert non-numeric string to a number you get a NaN