OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // floating-point imprecisions don't affect us. | 387 // floating-point imprecisions don't affect us. |
388 // | 388 // |
389 // Explanation for v's boundary m+: the computation takes advantage of | 389 // Explanation for v's boundary m+: the computation takes advantage of |
390 // the fact that 2^(p-1) <= f < 2^p. Boundaries still satisfy this requirement | 390 // the fact that 2^(p-1) <= f < 2^p. Boundaries still satisfy this requirement |
391 // (even for denormals where the delta can be much more important). | 391 // (even for denormals where the delta can be much more important). |
392 | 392 |
393 const double k1Log10 = 0.30102999566398114; // 1/lg(10) | 393 const double k1Log10 = 0.30102999566398114; // 1/lg(10) |
394 | 394 |
395 // For doubles len(f) == 53 (don't forget the hidden bit). | 395 // For doubles len(f) == 53 (don't forget the hidden bit). |
396 const int kSignificandSize = 53; | 396 const int kSignificandSize = 53; |
397 double estimate = ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10); | 397 double estimate = |
| 398 std::ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10); |
398 return static_cast<int>(estimate); | 399 return static_cast<int>(estimate); |
399 } | 400 } |
400 | 401 |
401 | 402 |
402 // See comments for InitialScaledStartValues. | 403 // See comments for InitialScaledStartValues. |
403 static void InitialScaledStartValuesPositiveExponent( | 404 static void InitialScaledStartValuesPositiveExponent( |
404 double v, int estimated_power, bool need_boundary_deltas, | 405 double v, int estimated_power, bool need_boundary_deltas, |
405 Bignum* numerator, Bignum* denominator, | 406 Bignum* numerator, Bignum* denominator, |
406 Bignum* delta_minus, Bignum* delta_plus) { | 407 Bignum* delta_minus, Bignum* delta_plus) { |
407 // A positive exponent implies a positive power. | 408 // A positive exponent implies a positive power. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 delta_minus->Times10(); | 650 delta_minus->Times10(); |
650 delta_plus->AssignBignum(*delta_minus); | 651 delta_plus->AssignBignum(*delta_minus); |
651 } else { | 652 } else { |
652 delta_minus->Times10(); | 653 delta_minus->Times10(); |
653 delta_plus->Times10(); | 654 delta_plus->Times10(); |
654 } | 655 } |
655 } | 656 } |
656 } | 657 } |
657 | 658 |
658 } } // namespace v8::internal | 659 } } // namespace v8::internal |
OLD | NEW |