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: https://en.wikipedia.org/wiki/Distance#Distance_in_Euclidean_space; "norm" is a mathematical construct that gives a few guarantees: https://en.wikipedia.org/wiki/Norm_%28mathematics%29) 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) _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

