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 3// found in the LICENSE file. 4 5function Module(stdlib) { 6 "use asm"; 7 8 var ceil = stdlib.Math.ceil; 9 10 // f: double -> float 11 function f(a) { 12 a = +a; 13 return ceil(a); 14 } 15 16 return { f: f }; 17} 18 19var f = Module({ Math: Math }).f; 20 21assertTrue(isNaN(f(NaN))); 22assertTrue(isNaN(f(undefined))); 23assertTrue(isNaN(f(function() {}))); 24 25assertEquals(0, f(0)); 26assertEquals(+0, f(+0)); 27assertEquals(-0, f(-0)); 28assertEquals(1, f(0.49999)); 29assertEquals(1, f(0.6)); 30assertEquals(1, f(0.5)); 31assertEquals(-0, f(-0.1)); 32assertEquals(-0, f(-0.5)); 33assertEquals(-0, f(-0.6)); 34assertEquals(-1, f(-1.6)); 35assertEquals(-0, f(-0.50001)); 36 37assertEquals("Infinity", String(f(Infinity))); 38assertEquals("-Infinity", String(f(-Infinity))); 39