OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdarg.h> | 5 #include <stdarg.h> |
6 #include <cmath> | 6 #include <cmath> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bignum.h" | 10 #include "src/bignum.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 1000000000000000.0, | 56 1000000000000000.0, |
57 10000000000000000.0, | 57 10000000000000000.0, |
58 100000000000000000.0, | 58 100000000000000000.0, |
59 1000000000000000000.0, | 59 1000000000000000000.0, |
60 10000000000000000000.0, | 60 10000000000000000000.0, |
61 100000000000000000000.0, // 10^20 | 61 100000000000000000000.0, // 10^20 |
62 1000000000000000000000.0, | 62 1000000000000000000000.0, |
63 // 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22 | 63 // 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22 |
64 10000000000000000000000.0 | 64 10000000000000000000000.0 |
65 }; | 65 }; |
66 static const int kExactPowersOfTenSize = ARRAY_SIZE(exact_powers_of_ten); | 66 static const int kExactPowersOfTenSize = arraysize(exact_powers_of_ten); |
67 | 67 |
68 // Maximum number of significant digits in the decimal representation. | 68 // Maximum number of significant digits in the decimal representation. |
69 // In fact the value is 772 (see conversions.cc), but to give us some margin | 69 // In fact the value is 772 (see conversions.cc), but to give us some margin |
70 // we round up to 780. | 70 // we round up to 780. |
71 static const int kMaxSignificantDecimalDigits = 780; | 71 static const int kMaxSignificantDecimalDigits = 780; |
72 | 72 |
73 static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) { | 73 static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) { |
74 for (int i = 0; i < buffer.length(); i++) { | 74 for (int i = 0; i < buffer.length(); i++) { |
75 if (buffer[i] != '0') { | 75 if (buffer[i] != '0') { |
76 return buffer.SubVector(i, buffer.length()); | 76 return buffer.SubVector(i, buffer.length()); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 double guess; | 414 double guess; |
415 if (DoubleStrtod(trimmed, exponent, &guess) || | 415 if (DoubleStrtod(trimmed, exponent, &guess) || |
416 DiyFpStrtod(trimmed, exponent, &guess)) { | 416 DiyFpStrtod(trimmed, exponent, &guess)) { |
417 return guess; | 417 return guess; |
418 } | 418 } |
419 return BignumStrtod(trimmed, exponent, guess); | 419 return BignumStrtod(trimmed, exponent, guess); |
420 } | 420 } |
421 | 421 |
422 } } // namespace v8::internal | 422 } } // namespace v8::internal |
OLD | NEW |