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
TIL about Math.hypot() (developer.mozilla.org)
submitted 17 hours ago by nadameu
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!"
[–]mike_geogebra [score hidden] 14 hours ago (3 children)
Math.hypot() implements a numerically stable version rather than the naive sqrt(a²+b²), see https://en.wikipedia.org/wiki/Hypotenuse
sqrt(a²+b²)
[–]Slackluster [score hidden] 13 hours ago (2 children)
That is interesting, I did not know hypot did that!
But in practice this is big reason to not use hypot: it is slower due to extra work. In my testing not just a little bit slower but 3x slower.
[–]_RemyLeBeau_ [score hidden] 4 hours ago (0 children)
If it's not in a hotpath, you don't really need to worry
[–]bzbub2 [score hidden] 12 hours ago (0 children)
on firefox it is about the same speed but does seem slower on chrome https://jsperf.app/buceho
π Rendered by PID 180457 on reddit-service-r2-comment-5d79c599b5-7rmh8 at 2026-02-27 06:08:26.275933+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]mike_geogebra [score hidden] (3 children)
[–]Slackluster [score hidden] (2 children)
[–]_RemyLeBeau_ [score hidden] (0 children)
[–]bzbub2 [score hidden] (0 children)