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

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

Issue 6460038: Version 3.1.3.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 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 | « test/cctest/test-disasm-ia32.cc ('k') | test/es5conform/es5conform.status » ('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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 CHECK_EQ(5708990770823838890407843763683279797179383808.0, 317 CHECK_EQ(5708990770823838890407843763683279797179383808.0,
318 StrtodChar("5708990770823838890407843763683279797179383808", 0)); 318 StrtodChar("5708990770823838890407843763683279797179383808", 0));
319 CHECK_EQ(5708990770823839524233143877797980545530986496.0, 319 CHECK_EQ(5708990770823839524233143877797980545530986496.0,
320 StrtodChar("5708990770823839524233143877797980545530986496", 0)); 320 StrtodChar("5708990770823839524233143877797980545530986496", 0));
321 CHECK_EQ(5708990770823839524233143877797980545530986496.0, 321 CHECK_EQ(5708990770823839524233143877797980545530986496.0,
322 StrtodChar("5708990770823839207320493820740630171355185152", 0)); 322 StrtodChar("5708990770823839207320493820740630171355185152", 0));
323 CHECK_EQ(5708990770823838890407843763683279797179383808.0, 323 CHECK_EQ(5708990770823838890407843763683279797179383808.0,
324 StrtodChar("5708990770823839207320493820740630171355185151999", -3)); 324 StrtodChar("5708990770823839207320493820740630171355185151999", -3));
325 CHECK_EQ(5708990770823839524233143877797980545530986496.0, 325 CHECK_EQ(5708990770823839524233143877797980545530986496.0,
326 StrtodChar("5708990770823839207320493820740630171355185152001", -3)); 326 StrtodChar("5708990770823839207320493820740630171355185152001", -3));
327
328 // The following test-cases got some public attention in early 2011 when they
329 // sent Java and PHP into an infinite loop.
330 CHECK_EQ(2.225073858507201e-308, StrtodChar("22250738585072011", -324));
331 CHECK_EQ(2.22507385850720138309e-308,
332 StrtodChar("22250738585072011360574097967091319759348195463516456480"
333 "23426109724822222021076945516529523908135087914149158913"
334 "03962110687008643869459464552765720740782062174337998814"
335 "10632673292535522868813721490129811224514518898490572223"
336 "07285255133155755015914397476397983411801999323962548289"
337 "01710708185069063066665599493827577257201576306269066333"
338 "26475653000092458883164330377797918696120494973903778297"
339 "04905051080609940730262937128958950003583799967207254304"
340 "36028407889577179615094551674824347103070260914462157228"
341 "98802581825451803257070188608721131280795122334262883686"
342 "22321503775666622503982534335974568884423900265498198385"
343 "48794829220689472168983109969836584681402285424333066033"
344 "98508864458040010349339704275671864433837704860378616227"
345 "71738545623065874679014086723327636718751", -1076));
327 } 346 }
328 347
329 348
330 static int CompareBignumToDiyFp(const Bignum& bignum_digits, 349 static int CompareBignumToDiyFp(const Bignum& bignum_digits,
331 int bignum_exponent, 350 int bignum_exponent,
332 DiyFp diy_fp) { 351 DiyFp diy_fp) {
333 Bignum bignum; 352 Bignum bignum;
334 bignum.AssignBignum(bignum_digits); 353 bignum.AssignBignum(bignum_digits);
335 Bignum other; 354 Bignum other;
336 other.AssignUInt64(diy_fp.f()); 355 other.AssignUInt64(diy_fp.f());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 buffer[pos++] = random() % 10 + '0'; 444 buffer[pos++] = random() % 10 + '0';
426 } 445 }
427 int exponent = DeterministicRandom() % (308*2 + 1) - 308 - length; 446 int exponent = DeterministicRandom() % (308*2 + 1) - 308 - length;
428 buffer[pos] = '\0'; 447 buffer[pos] = '\0';
429 Vector<const char> vector(buffer, pos); 448 Vector<const char> vector(buffer, pos);
430 double strtod_result = Strtod(vector, exponent); 449 double strtod_result = Strtod(vector, exponent);
431 CHECK(CheckDouble(vector, exponent, strtod_result)); 450 CHECK(CheckDouble(vector, exponent, strtod_result));
432 } 451 }
433 } 452 }
434 } 453 }
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-ia32.cc ('k') | test/es5conform/es5conform.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698