| OLD | NEW |
| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 bool FastDtoa(double v, | 695 bool FastDtoa(double v, |
| 696 FastDtoaMode mode, | 696 FastDtoaMode mode, |
| 697 int requested_digits, | 697 int requested_digits, |
| 698 Vector<char> buffer, | 698 Vector<char> buffer, |
| 699 int* length, | 699 int* length, |
| 700 int* decimal_point) { | 700 int* decimal_point) { |
| 701 ASSERT(v > 0); | 701 ASSERT(v > 0); |
| 702 ASSERT(!Double(v).IsSpecial()); | 702 ASSERT(!Double(v).IsSpecial()); |
| 703 | 703 |
| 704 bool result = false; | 704 bool result = false; |
| 705 int decimal_exponent; | 705 int decimal_exponent = 0; |
| 706 switch (mode) { | 706 switch (mode) { |
| 707 case FAST_DTOA_SHORTEST: | 707 case FAST_DTOA_SHORTEST: |
| 708 result = Grisu3(v, buffer, length, &decimal_exponent); | 708 result = Grisu3(v, buffer, length, &decimal_exponent); |
| 709 break; | 709 break; |
| 710 case FAST_DTOA_PRECISION: | 710 case FAST_DTOA_PRECISION: |
| 711 result = Grisu3Counted(v, requested_digits, | 711 result = Grisu3Counted(v, requested_digits, |
| 712 buffer, length, &decimal_exponent); | 712 buffer, length, &decimal_exponent); |
| 713 break; | 713 break; |
| 714 default: |
| 715 UNREACHABLE(); |
| 714 } | 716 } |
| 715 if (result) { | 717 if (result) { |
| 716 *decimal_point = *length + decimal_exponent; | 718 *decimal_point = *length + decimal_exponent; |
| 717 buffer[*length] = '\0'; | 719 buffer[*length] = '\0'; |
| 718 } | 720 } |
| 719 return result; | 721 return result; |
| 720 } | 722 } |
| 721 | 723 |
| 722 } } // namespace v8::internal | 724 } } // namespace v8::internal |
| OLD | NEW |