2 ms·
A lot of the bitching about react always had the same flavour of the complaints that JavaScript dares to have a NaN To be fair it is stupid that NaN !== NaN bu
by afiori 29d ago
A lot of the bitching about react always had the same flavour of the complaints that JavaScript dares to have a NaN
To be fair it is stupid that NaN !== NaN but that is how IEEE and CPUs made floats to be
- jjgreen 29d agoIt's not stupid when you realise that NaN is not "not a number" but rather "not a particular number", this becomes clear from hypot(Inf, NaN) being Inf rather than NaN
- afiori 23d agoNaN means only NaN, 0/0 is NaN at the cpu level. to my weak undestanding only pow and hypot behave like this; pow for math reasons and i could guess that hypot does that to sorta have |x| <= hypot(x,y)
- bryanrasmussen 29d agoI mean to me the whole point of NaN is that it should not equal NaN, so it seems sort of like you are making the complaint in the first sentence in your second sentence, only in a slightly more abstracted way. Unless you are of the opinion there is another better point to NaN? funny story, I was once interviewing for a job where the tech guy did not know that NaN existed. I guess JavaScript wasn't his language, but not sure what was, and the code was in JavaScript for a Web Dev role.
- afiori 23d agomy point is that that a lot of people shit on js for having "weird crazy stuff in it" and then the example is 0.1 + 0.1 + 0.1 !== 0.3 or NaN != NaN which has nothing to do with js semantics JS is weird, and not having a stronger separation between ints and floats makes NaNs more common than in other languages (eg parseInt would not return NaNs in C or python) but for many "weird" examples people are making fun of normal stuff.