This is so strange, I'm using node for some time now, and I never noticed such a thing. When I try to sum something like 0.7+0.2+0.1
or 0.6+0.3+0.1
, the result is 0.9999999999999999
. Why isn't the result 1
?
I need to validate that the sum of three variables is exactly 1, so I can't round this number, can someone help me understand why node is behaviouring like this? Here is my node version and some more examples/errors on terminal: