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

Side by Side Diff: runtime/third_party/double-conversion/src/strtod.cc

Issue 2850783002: Dart SDK Spelling b, c, and d. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « runtime/third_party/double-conversion/src/bignum-dtoa.cc ('k') | runtime/vm/constants_dbc.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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // If the guess doesn't lie near a single-precision boundary we can simply 521 // If the guess doesn't lie near a single-precision boundary we can simply
522 // return its float-value. 522 // return its float-value.
523 if (f1 == f4) { 523 if (f1 == f4) {
524 return float_guess; 524 return float_guess;
525 } 525 }
526 526
527 ASSERT((f1 != f2 && f2 == f3 && f3 == f4) || 527 ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
528 (f1 == f2 && f2 != f3 && f3 == f4) || 528 (f1 == f2 && f2 != f3 && f3 == f4) ||
529 (f1 == f2 && f2 == f3 && f3 != f4)); 529 (f1 == f2 && f2 == f3 && f3 != f4));
530 530
531 // guess and next are the two possible canditates (in the same way that 531 // guess and next are the two possible candidates (in the same way that
532 // double_guess was the lower candidate for a double-precision guess). 532 // double_guess was the lower candidate for a double-precision guess).
533 float guess = f1; 533 float guess = f1;
534 float next = f4; 534 float next = f4;
535 DiyFp upper_boundary; 535 DiyFp upper_boundary;
536 if (guess == 0.0f) { 536 if (guess == 0.0f) {
537 float min_float = 1e-45f; 537 float min_float = 1e-45f;
538 upper_boundary = Double(static_cast<double>(min_float) / 2).AsDiyFp(); 538 upper_boundary = Double(static_cast<double>(min_float) / 2).AsDiyFp();
539 } else { 539 } else {
540 upper_boundary = Single(guess).UpperBoundary(); 540 upper_boundary = Single(guess).UpperBoundary();
541 } 541 }
542 int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary); 542 int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
543 if (comparison < 0) { 543 if (comparison < 0) {
544 return guess; 544 return guess;
545 } else if (comparison > 0) { 545 } else if (comparison > 0) {
546 return next; 546 return next;
547 } else if ((Single(guess).Significand() & 1) == 0) { 547 } else if ((Single(guess).Significand() & 1) == 0) {
548 // Round towards even. 548 // Round towards even.
549 return guess; 549 return guess;
550 } else { 550 } else {
551 return next; 551 return next;
552 } 552 }
553 } 553 }
554 554
555 } // namespace double_conversion 555 } // namespace double_conversion
OLDNEW
« no previous file with comments | « runtime/third_party/double-conversion/src/bignum-dtoa.cc ('k') | runtime/vm/constants_dbc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698