OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 assertEquals(2, Math.round(1.5)); | 174 assertEquals(2, Math.round(1.5)); |
175 assertEquals(-1, Math.round(-1.5)); | 175 assertEquals(-1, Math.round(-1.5)); |
176 assertEquals("Infinity", String(Math.round(Infinity))); | 176 assertEquals("Infinity", String(Math.round(Infinity))); |
177 assertEquals("-Infinity", String(Math.round(-Infinity))); | 177 assertEquals("-Infinity", String(Math.round(-Infinity))); |
178 assertEquals("Infinity", String(1 / Math.round(0.0))); | 178 assertEquals("Infinity", String(1 / Math.round(0.0))); |
179 assertEquals("-Infinity", String(1 / Math.round(-0.0))); | 179 assertEquals("-Infinity", String(1 / Math.round(-0.0))); |
180 assertEquals("NaN", String(Math.round(NaN))); | 180 assertEquals("NaN", String(Math.round(NaN))); |
181 assertEquals(Math.pow(2, 52) + 1, Math.round(Math.pow(2, 52) + 1)); | 181 assertEquals(Math.pow(2, 52) + 1, Math.round(Math.pow(2, 52) + 1)); |
182 }); | 182 }); |
183 | 183 |
| 184 test(function mathFround() { |
| 185 assertTrue(isNaN(Math.fround(NaN))); |
| 186 assertEquals("Infinity", String(1/Math.fround(0))); |
| 187 assertEquals("-Infinity", String(1/Math.fround(-0))); |
| 188 assertEquals("Infinity", String(Math.fround(Infinity))); |
| 189 assertEquals("-Infinity", String(Math.fround(-Infinity))); |
| 190 assertEquals("Infinity", String(Math.fround(1E200))); |
| 191 assertEquals("-Infinity", String(Math.fround(-1E200))); |
| 192 assertEquals(3.1415927410125732, Math.fround(Math.PI)); |
| 193 }); |
| 194 |
184 test(function mathFloor() { | 195 test(function mathFloor() { |
185 assertEquals(1, Math.floor(1.5)); | 196 assertEquals(1, Math.floor(1.5)); |
186 assertEquals(-2, Math.floor(-1.5)); | 197 assertEquals(-2, Math.floor(-1.5)); |
187 assertEquals("Infinity", String(Math.floor(Infinity))); | 198 assertEquals("Infinity", String(Math.floor(Infinity))); |
188 assertEquals("-Infinity", String(Math.floor(-Infinity))); | 199 assertEquals("-Infinity", String(Math.floor(-Infinity))); |
189 assertEquals("Infinity", String(1 / Math.floor(0.0))); | 200 assertEquals("Infinity", String(1 / Math.floor(0.0))); |
190 assertEquals("-Infinity", String(1 / Math.floor(-0.0))); | 201 assertEquals("-Infinity", String(1 / Math.floor(-0.0))); |
191 assertEquals("NaN", String(Math.floor(NaN))); | 202 assertEquals("NaN", String(Math.floor(NaN))); |
192 assertEquals(Math.pow(2, 52) + 1, Math.floor(Math.pow(2, 52) + 1)); | 203 assertEquals(Math.pow(2, 52) + 1, Math.floor(Math.pow(2, 52) + 1)); |
193 }); | 204 }); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 }); | 245 }); |
235 | 246 |
236 | 247 |
237 test(function int32Mod() { | 248 test(function int32Mod() { |
238 assertEquals(-0, -2147483648 % (-1)); | 249 assertEquals(-0, -2147483648 % (-1)); |
239 }); | 250 }); |
240 | 251 |
241 test(function int32Div() { | 252 test(function int32Div() { |
242 assertEquals(2147483648, -2147483648 / (-1)); | 253 assertEquals(2147483648, -2147483648 / (-1)); |
243 }); | 254 }); |
OLD | NEW |