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

Side by Side Diff: src/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 | « src/spaces.cc ('k') | src/stub-cache.h » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 double Strtod(Vector<const char> buffer, int exponent) { 415 double Strtod(Vector<const char> buffer, int exponent) {
416 Vector<const char> left_trimmed = TrimLeadingZeros(buffer); 416 Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
417 Vector<const char> trimmed = TrimTrailingZeros(left_trimmed); 417 Vector<const char> trimmed = TrimTrailingZeros(left_trimmed);
418 exponent += left_trimmed.length() - trimmed.length(); 418 exponent += left_trimmed.length() - trimmed.length();
419 if (trimmed.length() == 0) return 0.0; 419 if (trimmed.length() == 0) return 0.0;
420 if (trimmed.length() > kMaxSignificantDecimalDigits) { 420 if (trimmed.length() > kMaxSignificantDecimalDigits) {
421 char significant_buffer[kMaxSignificantDecimalDigits]; 421 char significant_buffer[kMaxSignificantDecimalDigits];
422 int significant_exponent; 422 int significant_exponent;
423 TrimToMaxSignificantDigits(trimmed, exponent, 423 TrimToMaxSignificantDigits(trimmed, exponent,
424 significant_buffer, &significant_exponent); 424 significant_buffer, &significant_exponent);
425 trimmed = 425 return Strtod(Vector<const char>(significant_buffer,
426 Vector<const char>(significant_buffer, kMaxSignificantDecimalDigits); 426 kMaxSignificantDecimalDigits),
427 exponent = significant_exponent; 427 significant_exponent);
428 } 428 }
429 if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) return V8_INFINITY; 429 if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) return V8_INFINITY;
430 if (exponent + trimmed.length() <= kMinDecimalPower) return 0.0; 430 if (exponent + trimmed.length() <= kMinDecimalPower) return 0.0;
431 431
432 double guess; 432 double guess;
433 if (DoubleStrtod(trimmed, exponent, &guess) || 433 if (DoubleStrtod(trimmed, exponent, &guess) ||
434 DiyFpStrtod(trimmed, exponent, &guess)) { 434 DiyFpStrtod(trimmed, exponent, &guess)) {
435 return guess; 435 return guess;
436 } 436 }
437 return BignumStrtod(trimmed, exponent, guess); 437 return BignumStrtod(trimmed, exponent, guess);
438 } 438 }
439 439
440 } } // namespace v8::internal 440 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698