Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Unified Diff: test/mjsunit/toint32.js

Issue 28020: Even more tests of ToInt32 conversion (from Lasse). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/toint32.js
===================================================================
--- test/mjsunit/toint32.js (revision 1333)
+++ test/mjsunit/toint32.js (working copy)
@@ -113,3 +113,17 @@
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698