truncateDouble.js (258B)
1 // check correctness of truncation of doubles slightly outside the int32_t range. 2 3 function truncate(x) { 4 return x | 0; 5 } 6 7 assertEq(truncate(0xffffffff), -1); 8 assertEq(truncate(0xffffffff + 5000.5), 4999); 9 assertEq(truncate(-0xffffffff - 5000.5), -4999);