blob: de1e1344a06da05e2ad8df70552b7687cc241c09 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function testRound(value)
{
return Math.round(value);
}
noInline(testRound);
function testFloor(value)
{
return Math.floor(value);
}
noInline(testFloor);
function testCeil(value)
{
return Math.ceil(value);
}
noInline(testCeil);
function testTrunc(value)
{
return Math.trunc(value);
}
noInline(testTrunc);
for (var i = 0; i < 1e4; ++i) {
shouldBe(Number.isNaN(testRound(NaN)), true);
shouldBe(Number.isNaN(testFloor(NaN)), true);
shouldBe(Number.isNaN(testCeil(NaN)), true);
shouldBe(Number.isNaN(testTrunc(NaN)), true);
}