Feedback on hypot and hypot2

Christian Mayer mail at
Mon Aug 13 10:56:59 PDT 2012

Am 13.08.2012 11:16, schrieb David Bruant:
> I'd like to talk about naming as well. "hypot" (for "Hypotenuse") is an
> accurate name for the 2 dimension case, but much less for 3 dimensions
> as far as I know (the English wikipedia page [2] doesn't mention the 3D
> case either) and even less for N-dimension.
> I think it would make sense to rename it. Maybe "euclidianDistance" (too
> long?), "distance" [3] (accurate mathematically, but may sound vague in
> the broader context of JavaScript), "eucl" (too cryptic?), other?

The correct mathematical name would be "norm".

And there are different ways a function could work and it still would be
a norm (see this section on the wikipedia page you've posted:;
"norm" is a mathematical construct that gives a few guarantees:

Three norms are used quite often so they'd profit from a native function:
* 1-norm (usually the fastest to compute)
* 2-norm (hypot in the 2d case; usually the squared value is enough as
          well as faster to compute, so it's much more often used in
          numerical algorithms)
* infinity-norm (the least used variant)

More information about the es-discuss mailing list