Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame^] | 1 | // |
| 2 | // Copyright 2018 The Abseil Authors. |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | // This test helper library contains a table of powers of 10, to guarantee |
| 17 | // precise values are computed across the full range of doubles. We can't rely |
| 18 | // on the pow() function, because not all standard libraries ship a version |
| 19 | // that is precise. |
| 20 | #ifndef ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ |
| 21 | #define ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ |
| 22 | |
| 23 | #include <vector> |
| 24 | |
| 25 | namespace absl { |
| 26 | namespace strings_internal { |
| 27 | |
| 28 | // Computes the precise value of 10^exp. (I.e. the nearest representable |
| 29 | // double to the exact value, rounding to nearest-even in the (single) case of |
| 30 | // being exactly halfway between.) |
| 31 | double Pow10(int exp); |
| 32 | |
| 33 | } // namespace strings_internal |
| 34 | } // namespace absl |
| 35 | |
| 36 | #endif // ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ |