Replying to the four proposals you sent in one mail for easier discussion:

OK.  I've replied to your replies in this thread as 4 short posts.

*** Make Math.hypot(x,y,z,...) variadic ***
This sounds like a reasonable extension.  Oddly, I haven't seen any other
libraries support a variadic hypot function, but the use cases seem
obvious enough.

Thanks.
I also posted a top-level thread "explicit detail of Math.hypot", but this
post doesn't seem to have arrived.  Perhaps it's awaiting moderation(?).
Anyway the two paragraphs are repeated below...

The documentation of Math.hypot should point out that hypot avoids overflow
and minimises cancellation (& rounding) errors.  Otherwise people might be
tempted to naively use Math.sqrt.  This is easily implemented by dividing
through by the largest argument then multiplying back at the end in the
obvious way.

The existing doc of Math.hypot  describes the result of Math.hypot as NaN if
x or y is NaN.  IEEE754 defines hypot of Infinity with anything (even NaN)
as Infinity, thus:
     hypot(Infinity,NaN) == hypot(NaN,-Infinity) == ... == Infinity
Note that JavaScript already correctly deals with the indefinite number NaN
in Math.pow:
     Math.pow(NaN,0) == 1
(This is correct since pow(x,0)==1 for all x.)


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to