1*0e209d39SAndroid Build Coastguard Worker // © 2018 and later: Unicode, Inc. and others. 2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html 3*0e209d39SAndroid Build Coastguard Worker // 4*0e209d39SAndroid Build Coastguard Worker // From the double-conversion library. Original license: 5*0e209d39SAndroid Build Coastguard Worker // 6*0e209d39SAndroid Build Coastguard Worker // Copyright 2010 the V8 project authors. All rights reserved. 7*0e209d39SAndroid Build Coastguard Worker // Redistribution and use in source and binary forms, with or without 8*0e209d39SAndroid Build Coastguard Worker // modification, are permitted provided that the following conditions are 9*0e209d39SAndroid Build Coastguard Worker // met: 10*0e209d39SAndroid Build Coastguard Worker // 11*0e209d39SAndroid Build Coastguard Worker // * Redistributions of source code must retain the above copyright 12*0e209d39SAndroid Build Coastguard Worker // notice, this list of conditions and the following disclaimer. 13*0e209d39SAndroid Build Coastguard Worker // * Redistributions in binary form must reproduce the above 14*0e209d39SAndroid Build Coastguard Worker // copyright notice, this list of conditions and the following 15*0e209d39SAndroid Build Coastguard Worker // disclaimer in the documentation and/or other materials provided 16*0e209d39SAndroid Build Coastguard Worker // with the distribution. 17*0e209d39SAndroid Build Coastguard Worker // * Neither the name of Google Inc. nor the names of its 18*0e209d39SAndroid Build Coastguard Worker // contributors may be used to endorse or promote products derived 19*0e209d39SAndroid Build Coastguard Worker // from this software without specific prior written permission. 20*0e209d39SAndroid Build Coastguard Worker // 21*0e209d39SAndroid Build Coastguard Worker // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22*0e209d39SAndroid Build Coastguard Worker // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23*0e209d39SAndroid Build Coastguard Worker // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24*0e209d39SAndroid Build Coastguard Worker // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25*0e209d39SAndroid Build Coastguard Worker // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26*0e209d39SAndroid Build Coastguard Worker // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27*0e209d39SAndroid Build Coastguard Worker // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28*0e209d39SAndroid Build Coastguard Worker // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29*0e209d39SAndroid Build Coastguard Worker // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30*0e209d39SAndroid Build Coastguard Worker // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31*0e209d39SAndroid Build Coastguard Worker // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32*0e209d39SAndroid Build Coastguard Worker 33*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: ifdef around UCONFIG_NO_FORMATTING 34*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h" 35*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING 36*0e209d39SAndroid Build Coastguard Worker 37*0e209d39SAndroid Build Coastguard Worker #ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_ 38*0e209d39SAndroid Build Coastguard Worker #define DOUBLE_CONVERSION_CACHED_POWERS_H_ 39*0e209d39SAndroid Build Coastguard Worker 40*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: Customize header file paths for ICU. 41*0e209d39SAndroid Build Coastguard Worker 42*0e209d39SAndroid Build Coastguard Worker #include "double-conversion-diy-fp.h" 43*0e209d39SAndroid Build Coastguard Worker 44*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: Wrap in ICU namespace 45*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN 46*0e209d39SAndroid Build Coastguard Worker 47*0e209d39SAndroid Build Coastguard Worker namespace double_conversion::PowersOfTenCache { 48*0e209d39SAndroid Build Coastguard Worker 49*0e209d39SAndroid Build Coastguard Worker // Not all powers of ten are cached. The decimal exponent of two neighboring 50*0e209d39SAndroid Build Coastguard Worker // cached numbers will differ by kDecimalExponentDistance. 51*0e209d39SAndroid Build Coastguard Worker static const int kDecimalExponentDistance = 8; 52*0e209d39SAndroid Build Coastguard Worker 53*0e209d39SAndroid Build Coastguard Worker static const int kMinDecimalExponent = -348; 54*0e209d39SAndroid Build Coastguard Worker static const int kMaxDecimalExponent = 340; 55*0e209d39SAndroid Build Coastguard Worker 56*0e209d39SAndroid Build Coastguard Worker // Returns a cached power-of-ten with a binary exponent in the range 57*0e209d39SAndroid Build Coastguard Worker // [min_exponent; max_exponent] (boundaries included). 58*0e209d39SAndroid Build Coastguard Worker void GetCachedPowerForBinaryExponentRange(int min_exponent, 59*0e209d39SAndroid Build Coastguard Worker int max_exponent, 60*0e209d39SAndroid Build Coastguard Worker DiyFp* power, 61*0e209d39SAndroid Build Coastguard Worker int* decimal_exponent); 62*0e209d39SAndroid Build Coastguard Worker 63*0e209d39SAndroid Build Coastguard Worker // Returns a cached power of ten x ~= 10^k such that 64*0e209d39SAndroid Build Coastguard Worker // k <= decimal_exponent < k + kCachedPowersDecimalDistance. 65*0e209d39SAndroid Build Coastguard Worker // The given decimal_exponent must satisfy 66*0e209d39SAndroid Build Coastguard Worker // kMinDecimalExponent <= requested_exponent, and 67*0e209d39SAndroid Build Coastguard Worker // requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance. 68*0e209d39SAndroid Build Coastguard Worker void GetCachedPowerForDecimalExponent(int requested_exponent, 69*0e209d39SAndroid Build Coastguard Worker DiyFp* power, 70*0e209d39SAndroid Build Coastguard Worker int* found_exponent); 71*0e209d39SAndroid Build Coastguard Worker 72*0e209d39SAndroid Build Coastguard Worker } // namespace double_conversion::PowersOfTenCache 73*0e209d39SAndroid Build Coastguard Worker 74*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: Close ICU namespace 75*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END 76*0e209d39SAndroid Build Coastguard Worker 77*0e209d39SAndroid Build Coastguard Worker #endif // DOUBLE_CONVERSION_CACHED_POWERS_H_ 78*0e209d39SAndroid Build Coastguard Worker #endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING 79