I think the spec says that
Math.hypot() ===> NaN
Math.hypot(1) ===> NaN
Math.hypot(1, 2, 2, 4) ===> 3
Math.hypot(3, 4, undefined) ===> NaN
Is that correct?
I'm basing this on paragraph 4 of clause 15, plus the first sentence
of 15.8.2, plus the fact that Math.hypot() appears to "require" 2
arguments.
The last case illustrates that the default argument syntax used in the heading:
15.8.2.29 Math.hypot( value1 , value2, value3 = 0 )
is not quite how the function behaves.
How about we change this function to take any number of arguments
(like Math.max), convert them all using ToNumber, and compute the
norm?
Math.hypot() ===> 0
Math.hypot(1) ===> 1
Math.hypot(1, 2, 2, 4) ===> 5
Allowing 3 arguments but ignoring the 4th seems like a bit of a head
fake, to me.
-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss