OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --turbo-asm | |
6 | |
7 function Module(stdlib) { | 5 function Module(stdlib) { |
8 "use asm"; | 6 "use asm"; |
9 | 7 |
10 var fround = stdlib.Math.fround; | 8 var fround = stdlib.Math.fround; |
11 | 9 |
12 // f: double -> float | 10 // f: double -> float |
13 function f(a) { | 11 function f(a) { |
14 a = +a; | 12 a = +a; |
15 return fround(a); | 13 return fround(a); |
16 } | 14 } |
(...skipping 14 matching lines...) Expand all Loading... |
31 assertEquals("Infinity", String(f(1E200))); | 29 assertEquals("Infinity", String(f(1E200))); |
32 assertEquals("-Infinity", String(f(-1E200))); | 30 assertEquals("-Infinity", String(f(-1E200))); |
33 assertEquals("Infinity", String(1/f(1E-300))); | 31 assertEquals("Infinity", String(1/f(1E-300))); |
34 assertEquals("-Infinity", String(1/f(-1E-300))); | 32 assertEquals("-Infinity", String(1/f(-1E-300))); |
35 | 33 |
36 assertEquals(0, f(0)); | 34 assertEquals(0, f(0)); |
37 assertEquals(1, f(1)); | 35 assertEquals(1, f(1)); |
38 assertEquals(1.5, f(1.5)); | 36 assertEquals(1.5, f(1.5)); |
39 assertEquals(1.3370000123977661, f(1.337)); | 37 assertEquals(1.3370000123977661, f(1.337)); |
40 assertEquals(-4.300000190734863, f(-4.3)); | 38 assertEquals(-4.300000190734863, f(-4.3)); |
OLD | NEW |