| 1 |
setJitCompilerOption("baseline.warmup.trigger", 10); |
| 2 |
setJitCompilerOption("ion.warmup.trigger", 20); |
| 3 |
|
| 4 |
function myCeil(x) { |
| 5 |
if(x >= 0) { |
| 6 |
var r = Math.abs(x % 1); |
| 7 |
if(r != 0) |
| 8 |
return (x + 1) - r; |
| 9 |
else |
| 10 |
return x; |
| 11 |
} |
| 12 |
else |
| 13 |
return x + Math.abs(x % 1); |
| 14 |
} |
| 15 |
|
| 16 |
function ceilRangeTest(x) { |
| 17 |
if(10 < x) { |
| 18 |
if(x < 100) { |
| 19 |
assertEq(Math.ceil(x), myCeil(x)); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
if(-100 < x) { |
| 24 |
if(x < -10) { |
| 25 |
assertEq(Math.ceil(x), myCeil(x)); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
if (-(4294967296 - 1) < x) { |
| 30 |
if(x < 10) { |
| 31 |
assertEq(Math.ceil(x), myCeil(x)); |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
if (-10 < x) { |
| 36 |
if(x < 4294967296) { |
| 37 |
assertEq(Math.ceil(x), myCeil(x)); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
if (-2147483648 < x) { |
| 42 |
if(x < 10) { |
| 43 |
assertEq(Math.ceil(x), myCeil(x)); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if ((-2147483648 -1) < x) { |
| 48 |
if(x < 10) { |
| 49 |
assertEq(Math.ceil(x), myCeil(x)); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
if (10 < x) { |
| 54 |
if(x < 2147483648) { |
| 55 |
assertEq(Math.ceil(x), myCeil(x)); |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
if (10 < x) { |
| 60 |
if(x < 2147483649) { |
| 61 |
assertEq(Math.ceil(x), myCeil(x)); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
if (Math.pow(2,31) < x) { |
| 66 |
if(x < Math.pow(2,33)) { |
| 67 |
assertEq(Math.ceil(x), myCeil(x)); |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
var a = [Math.pow(2,31), Math.pow(2,33), -4294967296.4, 214748364.2, -50.4, 50.4]; |
| 73 |
|
| 74 |
for(var i = 0; i < 10; i++) { |
| 75 |
for (var j = 0; j < a.length; j++) { |
| 76 |
ceilRangeTest(a[j]); |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
for (var j = 0; j < 30; j++) { |
| 81 |
(function() { |
| 82 |
Math.ceil(1.5); |
| 83 |
})() |
| 84 |
} |
| 85 |
|
| 86 |
for (var j = 0; j < 30; j++) { |
| 87 |
(function() { |
| 88 |
Math.ceil(-1.5); |
| 89 |
})() |
| 90 |
} |
| 91 |
|
| 92 |
for (var j = 0; j < 30; j++) { |
| 93 |
(function() { |
| 94 |
Math.ceil(-127.5); |
| 95 |
})() |
| 96 |
} |