how about more args for Math.hypot

Jens Nockert jens at
Thu Mar 15 08:57:45 PDT 2012

On Mar 15, 2012, at 12:42 PM, alawatthe wrote:

> Just yesterday I released my JavaScript library for mathematical computations
> It supports more than two arguments in it's hypot function. 
> So there is at least one library supporting variadic hypot functions :-)

Except that a variadic hypot function is non-trivial to implement (in a way that people expect it to behave), the one implemented above is essentially just sugar and can overflow even though the result is inside the range of a double.

Usually hypot is implemented something like |x| * sqrt(1 + (y / x)^2) (|x| > |y|) instead, but such a formula for a variadic hypot is probably non-trivial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list