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

Side by Side Diff: test/cctest/test-strtod.cc

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month 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 | « test/cctest/test-parsing.cc ('k') | test/mjsunit/regress/regress-918.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "bignum.h" 7 #include "bignum.h"
8 #include "cctest.h" 8 #include "cctest.h"
9 #include "diy-fp.h" 9 #include "diy-fp.h"
10 #include "double.h" 10 #include "double.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 StrtodChar("1234567890123456789052345", 111)); 252 StrtodChar("1234567890123456789052345", 111));
253 CHECK_EQ(1234567890123456789052345e112, 253 CHECK_EQ(1234567890123456789052345e112,
254 StrtodChar("1234567890123456789052345", 112)); 254 StrtodChar("1234567890123456789052345", 112));
255 CHECK_EQ(1234567890123456789052345e113, 255 CHECK_EQ(1234567890123456789052345e113,
256 StrtodChar("1234567890123456789052345", 113)); 256 StrtodChar("1234567890123456789052345", 113));
257 CHECK_EQ(1234567890123456789052345e114, 257 CHECK_EQ(1234567890123456789052345e114,
258 StrtodChar("1234567890123456789052345", 114)); 258 StrtodChar("1234567890123456789052345", 114));
259 CHECK_EQ(1234567890123456789052345e115, 259 CHECK_EQ(1234567890123456789052345e115,
260 StrtodChar("1234567890123456789052345", 115)); 260 StrtodChar("1234567890123456789052345", 115));
261 261
262 CHECK_EQ(5.445618932859895e-255,
263 StrtodChar("5445618932859895362967233318697132813618813095743952975"
264 "4392982234069699615600475529427176366709107287468930197"
265 "8628345413991790019316974825934906752493984055268219809"
266 "5012176093045431437495773903922425632551857520884625114"
267 "6241265881735209066709685420744388526014389929047617597"
268 "0302268848374508109029268898695825171158085457567481507"
269 "4162979705098246243690189880319928315307816832576838178"
270 "2563074014542859888710209237525873301724479666744537857"
271 "9026553346649664045621387124193095870305991178772256504"
272 "4368663670643970181259143319016472430928902201239474588"
273 "1392338901353291306607057623202353588698746085415097902"
274 "6640064319118728664842287477491068264828851624402189317"
275 "2769161449825765517353755844373640588822904791244190695"
276 "2998382932630754670573838138825217065450843010498555058"
277 "88186560731", -1035));
278
262 // Boundary cases. Boundaries themselves should round to even. 279 // Boundary cases. Boundaries themselves should round to even.
263 // 280 //
264 // 0x1FFFFFFFFFFFF * 2^3 = 72057594037927928 281 // 0x1FFFFFFFFFFFF * 2^3 = 72057594037927928
265 // next: 72057594037927936 282 // next: 72057594037927936
266 // boundary: 72057594037927932 should round up. 283 // boundary: 72057594037927932 should round up.
267 CHECK_EQ(72057594037927928.0, StrtodChar("72057594037927928", 0)); 284 CHECK_EQ(72057594037927928.0, StrtodChar("72057594037927928", 0));
268 CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927936", 0)); 285 CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927936", 0));
269 CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927932", 0)); 286 CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927932", 0));
270 CHECK_EQ(72057594037927928.0, StrtodChar("7205759403792793199999", -5)); 287 CHECK_EQ(72057594037927928.0, StrtodChar("7205759403792793199999", -5));
271 CHECK_EQ(72057594037927936.0, StrtodChar("7205759403792793200001", -5)); 288 CHECK_EQ(72057594037927936.0, StrtodChar("7205759403792793200001", -5));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 buffer[pos++] = random() % 10 + '0'; 425 buffer[pos++] = random() % 10 + '0';
409 } 426 }
410 int exponent = DeterministicRandom() % (308*2 + 1) - 308 - length; 427 int exponent = DeterministicRandom() % (308*2 + 1) - 308 - length;
411 buffer[pos] = '\0'; 428 buffer[pos] = '\0';
412 Vector<const char> vector(buffer, pos); 429 Vector<const char> vector(buffer, pos);
413 double strtod_result = Strtod(vector, exponent); 430 double strtod_result = Strtod(vector, exponent);
414 CHECK(CheckDouble(vector, exponent, strtod_result)); 431 CHECK(CheckDouble(vector, exponent, strtod_result));
415 } 432 }
416 } 433 }
417 } 434 }
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/regress/regress-918.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698