Commit adc9362b authored by kasperl@chromium.org's avatar kasperl@chromium.org

Even more tests of ToInt32 conversion (from Lasse).

Review URL: http://codereview.chromium.org/28020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1335 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f6d9b194
......@@ -113,3 +113,17 @@ assertEquals(28672, toInt32(base + 27925));
assertEquals(28672, toInt32(base + 29042));
assertEquals(28672, toInt32(base + 30159));
assertEquals(32768, toInt32(base + 31276));
// bignum is (2^53 - 1) * 2^31 - highest number with bit 31 set.
var bignum = Math.pow(2, 84) - Math.pow(2, 31);
assertEquals(-Math.pow(2,31), toInt32(bignum));
assertEquals(-Math.pow(2,31), toInt32(-bignum));
assertEquals(0, toInt32(2 * bignum));
assertEquals(0, toInt32(-(2 * bignum)));
assertEquals(0, toInt32(bignum - Math.pow(2,31)));
assertEquals(0, toInt32(-(bignum - Math.pow(2,31))));
// max_fraction is largest number below 1.
var max_fraction = (1 - Math.pow(2,-53));
assertEquals(0, toInt32(max_fraction));
assertEquals(0, toInt32(-max_fraction));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment