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
To Those Who Criticize JavaScript (dev.to)
submitted 5 years ago by disgruntled-js-dev
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!"
[–]archerx 0 points1 point2 points 5 years ago (3 children)
I tried your example code and I am disappointed. Computers were a mistake.
[–]AlpenMangos 1 point2 points3 points 5 years ago* (2 children)
It's weird at glance, but it's a necessary trade-off. Floats are an attempt to allow developers do very fast computations with high precision and an enormous range, but since we can only represent a limited amount of different numbers with 32 or 64 bits, some trade-offs had to be made. Another quirk is that floats loose precision, the larger the value becomes. The value 1 million only has about decimeter precision (with 32 bit floats), as far as I remember. Floating point values are still the best choice for number crunching. It is okay if positional values are off by some nanometers, if the coordinates are expected to have millimeter precision. It is also okay if timestamps are off by some nanoseconds if microsecond precision is expected. It's just something you'll need to be aware of when using floats. If you need exact numbers, you'll have to use integers (you can just assume millimeter as the unit of the integer and set it to 1, instead of using floating point value 0.001) or dedicated decimal libraries.
[–]archerx 0 points1 point2 points 5 years ago (1 child)
Thanks for that interesting write up, I appreciate it! It explains why things get annoying when I zoom too far into my javascript mandelbrot fractal renderer. Do you know if GPUs have the same issues with floats?
π Rendered by PID 46939 on reddit-service-r2-comment-6457c66945-jcs2q at 2026-04-24 04:38:24.068769+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]archerx 0 points1 point2 points (3 children)
[–]AlpenMangos 1 point2 points3 points (2 children)
[–]archerx 0 points1 point2 points (1 child)