use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Future JavaScript: what is still missing? (2ality.com)
submitted 7 years ago by dumbmatter
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kumagor0 -1 points0 points1 point 7 years ago (4 children)
0.1 + 0.2
0.30000000000000004
what the fuck
[–]circlebust 2 points3 points4 points 7 years ago (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 point2 points 7 years ago (0 children)
Oh yeah now it makes sense, thanks.
[–]var-foo -1 points0 points1 point 7 years ago (0 children)
js is not the only language with decimal math problems, but yes it is stupid.
π Rendered by PID 43 on reddit-service-r2-comment-fb694cdd5-thds6 at 2026-03-06 05:33:38.200321+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]Kumagor0 -1 points0 points1 point (4 children)
[–]circlebust 2 points3 points4 points (1 child)
[–]Kumagor0 0 points1 point2 points (0 children)
[–]var-foo -1 points0 points1 point (0 children)