Feedback on hypot and hypot2

David Bruant bruant.d at
Mon Aug 13 02:16:02 PDT 2012


I'd like to provide some feedback on the more math functions proposal 
[1] (and the most recent PDF at the top of the page)
The hypot and hypot2 functions accept 2 or 3 arguments, but I don't see 
a reason why they wouldn't accept an unbounded number of arguments. 
Although the physical world can be accurately enough described in 3 
dimensions, math folks sometimes think in abstract N-dimension spaces 
and compute euclidian distances in these spaces.
JS Engines are still free to heavily optimize the common case of 2 or 3 

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?



More information about the es-discuss mailing list