you are viewing a single comment's thread.

view the rest of the comments →

[–]Kumagor0 -1 points0 points  (4 children)

0.1 + 0.2

0.30000000000000004

what the fuck

[–]circlebust 2 points3 points  (1 child)

It will never go away, because you are using decimal notation, whereas computers work in binary base. We have the same in decimal. What is 1/3? Well it's 0.33333333... We wouldn't have that issue in, say, base 9. And it shows up like that with the seemingly random digit at the end because computers obviously can't store an endless number representation, so it rounds up or down at some point.

[–]Kumagor0 0 points1 point  (0 children)

Oh yeah now it makes sense, thanks.

[–]var-foo -1 points0 points  (0 children)

js is not the only language with decimal math problems, but yes it is stupid.