Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Properties of Math.hypot that are guaranteed by the spec.
3 // If no arguments are passed, the result is +0.
4 assertEq(Math.hypot(), +0);
6 // If any argument is +∞, the result is +∞.
7 // If any argument is −∞, the result is +∞.
8 for (var inf of [Infinity, -Infinity]) {
9 assertEq(Math.hypot(inf, 0), Infinity);
10 assertEq(Math.hypot(0, inf), Infinity);
11 assertEq(Math.hypot(inf, inf), Infinity);
12 assertEq(Math.hypot(inf, -inf), Infinity);
14 assertEq(Math.hypot(inf, -0), Infinity);
15 assertEq(Math.hypot(-0, inf), Infinity);
16 assertEq(Math.hypot(inf, Math.MIN_VALUE), Infinity);
17 assertEq(Math.hypot(Math.MIN_VALUE, inf), Infinity);
18 assertEq(Math.hypot(inf, 1), Infinity);
19 assertEq(Math.hypot(1, inf), Infinity);
21 assertEq(Math.hypot(inf, 0, 0), Infinity);
22 assertEq(Math.hypot(0, inf, 0), Infinity);
23 assertEq(Math.hypot(0, 0, inf), Infinity);
25 assertEq(Math.hypot(inf, NaN), Infinity);
26 assertEq(Math.hypot(NaN, inf), Infinity);
28 assertEq(Math.hypot(inf, NaN, NaN), Infinity);
29 assertEq(Math.hypot(NaN, inf, NaN), Infinity);
30 assertEq(Math.hypot(NaN, NaN, inf), Infinity);
31 }
33 // If no argument is +∞ or −∞, and any argument is NaN, the result is NaN.
34 assertEq(Math.hypot(NaN), NaN);
36 assertEq(Math.hypot(NaN, 0), NaN);
37 assertEq(Math.hypot(0, NaN), NaN);
39 assertEq(Math.hypot(NaN, NaN), NaN);
41 assertEq(Math.hypot(NaN, 0, 0), NaN);
42 assertEq(Math.hypot(0, NaN, 0), NaN);
43 assertEq(Math.hypot(0, 0, NaN), NaN);
45 assertEq(Math.hypot(Number.MAX_VALUE, Number.MIN_VALUE, NaN), NaN);
47 // If all arguments are either +0 or -0, the result is +0.
48 assertEq(Math.hypot(-0, -0), +0);
49 assertEq(Math.hypot(+0, -0), +0);
51 assertEq(Math.hypot(-0, -0, -0), +0);
52 assertEq(Math.hypot(+0, -0, -0), +0);
53 assertEq(Math.hypot(-0, +0, -0), +0);
54 assertEq(Math.hypot(+0, +0, -0), +0);
56 // The length property of the hypot function is 2.
57 assertEq(Math.hypot.length, 2);