Lines Matching defs:toInt32
28 function toInt32(x) {
32 assertEquals(0, toInt32(Infinity), "Inf");
33 assertEquals(0, toInt32(-Infinity), "-Inf");
34 assertEquals(0, toInt32(NaN), "NaN");
35 assertEquals(0, toInt32(0.0), "zero");
36 assertEquals(0, toInt32(-0.0), "-zero");
38 assertEquals(0, toInt32(Number.MIN_VALUE));
39 assertEquals(0, toInt32(-Number.MIN_VALUE));
40 assertEquals(0, toInt32(0.1));
41 assertEquals(0, toInt32(-0.1));
42 assertEquals(1, toInt32(1), "one");
43 assertEquals(1, toInt32(1.1), "onepointone");
44 assertEquals(-1, toInt32(-1), "-one");
45 assertEquals(0, toInt32(0.6), "truncate positive (0.6)");
46 assertEquals(1, toInt32(1.6), "truncate positive (1.6)");
47 assertEquals(0, toInt32(-0.6), "truncate negative (-0.6)");
48 assertEquals(-1, toInt32(-1.6), "truncate negative (-1.6)");
50 assertEquals(2147483647, toInt32(2147483647));
51 assertEquals(-2147483648, toInt32(2147483648));
52 assertEquals(-2147483647, toInt32(2147483649));
54 assertEquals(-1, toInt32(4294967295));
55 assertEquals(0, toInt32(4294967296));
56 assertEquals(1, toInt32(4294967297));
58 assertEquals(-2147483647, toInt32(-2147483647));
59 assertEquals(-2147483648, toInt32(-2147483648));
60 assertEquals(2147483647, toInt32(-2147483649));
62 assertEquals(1, toInt32(-4294967295));
63 assertEquals(0, toInt32(-4294967296));
64 assertEquals(-1, toInt32(-4294967297));
66 assertEquals(-2147483648, toInt32(2147483648.25));
67 assertEquals(-2147483648, toInt32(2147483648.5));
68 assertEquals(-2147483648, toInt32(2147483648.75));
69 assertEquals(-1, toInt32(4294967295.25));
70 assertEquals(-1, toInt32(4294967295.5));
71 assertEquals(-1, toInt32(4294967295.75));
72 assertEquals(-1294967296, toInt32(3000000000.25));
73 assertEquals(-1294967296, toInt32(3000000000.5));
74 assertEquals(-1294967296, toInt32(3000000000.75));
76 assertEquals(-2147483648, toInt32(-2147483648.25));
77 assertEquals(-2147483648, toInt32(-2147483648.5));
78 assertEquals(-2147483648, toInt32(-2147483648.75));
79 assertEquals(1, toInt32(-4294967295.25));
80 assertEquals(1, toInt32(-4294967295.5));
81 assertEquals(1, toInt32(-4294967295.75));
82 assertEquals(1294967296, toInt32(-3000000000.25));
83 assertEquals(1294967296, toInt32(-3000000000.5));
84 assertEquals(1294967296, toInt32(-3000000000.75));
87 assertEquals(0, toInt32(base + 0));
88 assertEquals(0, toInt32(base + 1117));
89 assertEquals(4096, toInt32(base + 2234));
90 assertEquals(4096, toInt32(base + 3351));
91 assertEquals(4096, toInt32(base + 4468));
92 assertEquals(4096, toInt32(base + 5585));
93 assertEquals(8192, toInt32(base + 6702));
94 assertEquals(8192, toInt32(base + 7819));
95 assertEquals(8192, toInt32(base + 8936));
96 assertEquals(8192, toInt32(base + 10053));
97 assertEquals(12288, toInt32(base + 11170));
98 assertEquals(12288, toInt32(base + 12287));
99 assertEquals(12288, toInt32(base + 13404));
100 assertEquals(16384, toInt32(base + 14521));
101 assertEquals(16384, toInt32(base + 15638));
102 assertEquals(16384, toInt32(base + 16755));
103 assertEquals(16384, toInt32(base + 17872));
104 assertEquals(20480, toInt32(base + 18989));
105 assertEquals(20480, toInt32(base + 20106));
106 assertEquals(20480, toInt32(base + 21223));
107 assertEquals(20480, toInt32(base + 22340));
108 assertEquals(24576, toInt32(base + 23457));
109 assertEquals(24576, toInt32(base + 24574));
110 assertEquals(24576, toInt32(base + 25691));
111 assertEquals(28672, toInt32(base + 26808));
112 assertEquals(28672, toInt32(base + 27925));
113 assertEquals(28672, toInt32(base + 29042));
114 assertEquals(28672, toInt32(base + 30159));
115 assertEquals(32768, toInt32(base + 31276));
119 assertEquals(-Math.pow(2,31), toInt32(bignum));
120 assertEquals(-Math.pow(2,31), toInt32(-bignum));
121 assertEquals(0, toInt32(2 * bignum));
122 assertEquals(0, toInt32(-(2 * bignum)));
123 assertEquals(0, toInt32(bignum - Math.pow(2,31)));
124 assertEquals(0, toInt32(-(bignum - Math.pow(2,31))));
128 assertEquals(0, toInt32(max_fraction));
129 assertEquals(0, toInt32(-max_fraction));