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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // remainder (remainders of exactly .5 round upwards). Might update the | 81 // remainder (remainders of exactly .5 round upwards). Might update the |
82 // decimal_point when rounding up (for example for 0.9999). | 82 // decimal_point when rounding up (for example for 0.9999). |
83 static void GenerateCountedDigits(int count, int* decimal_point, | 83 static void GenerateCountedDigits(int count, int* decimal_point, |
84 Bignum* numerator, Bignum* denominator, | 84 Bignum* numerator, Bignum* denominator, |
85 Vector<char>(buffer), int* length); | 85 Vector<char>(buffer), int* length); |
86 | 86 |
87 | 87 |
88 void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits, | 88 void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits, |
89 Vector<char> buffer, int* length, int* decimal_point) { | 89 Vector<char> buffer, int* length, int* decimal_point) { |
90 ASSERT(v > 0); | 90 ASSERT(v > 0); |
91 ASSERT(!Double(v).IsSpecial()); | 91 DCHECK(!Double(v).IsSpecial()); |
92 uint64_t significand = Double(v).Significand(); | 92 uint64_t significand = Double(v).Significand(); |
93 bool is_even = (significand & 1) == 0; | 93 bool is_even = (significand & 1) == 0; |
94 int exponent = Double(v).Exponent(); | 94 int exponent = Double(v).Exponent(); |
95 int normalized_exponent = NormalizedExponent(significand, exponent); | 95 int normalized_exponent = NormalizedExponent(significand, exponent); |
96 // estimated_power might be too low by 1. | 96 // estimated_power might be too low by 1. |
97 int estimated_power = EstimatePower(normalized_exponent); | 97 int estimated_power = EstimatePower(normalized_exponent); |
98 | 98 |
99 // Shortcut for Fixed. | 99 // Shortcut for Fixed. |
100 // The requested digits correspond to the digits after the point. If the | 100 // The requested digits correspond to the digits after the point. If the |
101 // number is much too small, then there is no need in trying to get any | 101 // number is much too small, then there is no need in trying to get any |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } else { | 648 } else { |
649 delta_minus->Times10(); | 649 delta_minus->Times10(); |
650 delta_plus->Times10(); | 650 delta_plus->Times10(); |
651 } | 651 } |
652 } | 652 } |
653 } | 653 } |
654 | 654 |
655 } // namespace double_conversion | 655 } // namespace double_conversion |
656 | 656 |
657 } // namespace WTF | 657 } // namespace WTF |
OLD | NEW |