And it works properly if you change it from a float to a strong first! JavaScript 🥰
…but why? This looks like it would never be expected behavior. Like a bug in the implementation, which can simply be fixed.
Oh no, it’s even documented on MDN:
Sweet Flying Spaghetti Monster, that’s horrible. I’m guessing the reason is to keep the truth value equivalent when casting to boolean, but there has to be a more elegant way…
Might be, but this is also a decent explanation: https://lemmy.ml/post/464637/comment/272066
It amazes me that people write financial software in JS. What can possibly go wrong :D
Javascript in a nutshell
Technically, the top and bottom lines on classical math approach 1 and 0, like limits.
As far as I’m aware, there’s actually no consensus on what’s technically correct.
Some will argue that they don’t approach these values, because you’re not saying
lim x from 0 to ∞, where x is the number of '9'-digits
. Instead, you’re saying that the number of digits is already infinite right now.
2**53 + 1 == 2**53