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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 assertEquals(20480, toInt32(base + 21223)); 106 assertEquals(20480, toInt32(base + 21223));
107 assertEquals(20480, toInt32(base + 22340)); 107 assertEquals(20480, toInt32(base + 22340));
108 assertEquals(24576, toInt32(base + 23457)); 108 assertEquals(24576, toInt32(base + 23457));
109 assertEquals(24576, toInt32(base + 24574)); 109 assertEquals(24576, toInt32(base + 24574));
110 assertEquals(24576, toInt32(base + 25691)); 110 assertEquals(24576, toInt32(base + 25691));
111 assertEquals(28672, toInt32(base + 26808)); 111 assertEquals(28672, toInt32(base + 26808));
112 assertEquals(28672, toInt32(base + 27925)); 112 assertEquals(28672, toInt32(base + 27925));
113 assertEquals(28672, toInt32(base + 29042)); 113 assertEquals(28672, toInt32(base + 29042));
114 assertEquals(28672, toInt32(base + 30159)); 114 assertEquals(28672, toInt32(base + 30159));
115 assertEquals(32768, toInt32(base + 31276)); 115 assertEquals(32768, toInt32(base + 31276));
116
117 // bignum is (2^53 - 1) * 2^31 - highest number with bit 31 set.
118 var bignum = Math.pow(2, 84) - Math.pow(2, 31);
119 assertEquals(-Math.pow(2,31), toInt32(bignum));
120 assertEquals(-Math.pow(2,31), toInt32(-bignum));
121 assertEquals(0, toInt32(2 * bignum));
122 assertEquals(0, toInt32(-(2 * bignum)));
123 assertEquals(0, toInt32(bignum - Math.pow(2,31)));
124 assertEquals(0, toInt32(-(bignum - Math.pow(2,31))));
125
126 // max_fraction is largest number below 1.
127 var max_fraction = (1 - Math.pow(2,-53));
128 assertEquals(0, toInt32(max_fraction));
129 assertEquals(0, toInt32(-max_fraction));
OLDNEW
« 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