OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 function Module(stdlib, env, heap) { |
| 6 "use asm"; |
| 7 |
| 8 var a = new stdlib.Int32Array(heap); |
| 9 var b = new stdlib.Float32Array(heap); |
| 10 var fround = stdlib.Math.fround; |
| 11 var value = env.value|0; |
| 12 |
| 13 function foo() { |
| 14 var x = fround(0.0); |
| 15 x = (a[0]=value|0,fround(b[0])); |
| 16 return fround(x); |
| 17 } |
| 18 |
| 19 return { foo: foo }; |
| 20 } |
| 21 |
| 22 var buffer = new ArrayBuffer(32); |
| 23 assertEquals(0.0, Module(this, {value: 0x00000000}, buffer).foo()); |
| 24 assertEquals(-0.0, Module(this, {value: 0x80000000}, buffer).foo()); |
| 25 assertEquals(5.0, Module(this, {value: 0x40a00000}, buffer).foo()); |
| 26 assertEquals(-5.0, Module(this, {value: 0xc0a00000}, buffer).foo()); |
| 27 assertEquals(129.375, Module(this, {value: 0x43016000}, buffer).foo()); |
| 28 assertEquals(-129.375, Module(this, {value: 0xc3016000}, buffer).foo()); |
| 29 assertEquals(Infinity, Module(this, {value: 0x7f800000}, buffer).foo()); |
| 30 assertEquals(-Infinity, Module(this, {value: 0xff800000}, buffer).foo()); |
| 31 assertEquals(NaN, Module(this, {value: 0x7fffffff}, buffer).foo()); |
OLD | NEW |