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 2012 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_DOUBLE_TO_STRING_H_ 38*0e209d39SAndroid Build Coastguard Worker #define DOUBLE_CONVERSION_DOUBLE_TO_STRING_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-utils.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 { 48*0e209d39SAndroid Build Coastguard Worker 49*0e209d39SAndroid Build Coastguard Worker class DoubleToStringConverter { 50*0e209d39SAndroid Build Coastguard Worker public: 51*0e209d39SAndroid Build Coastguard Worker // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint 52*0e209d39SAndroid Build Coastguard Worker // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the 53*0e209d39SAndroid Build Coastguard Worker // function returns false. 54*0e209d39SAndroid Build Coastguard Worker static const int kMaxFixedDigitsBeforePoint = 60; 55*0e209d39SAndroid Build Coastguard Worker static const int kMaxFixedDigitsAfterPoint = 100; 56*0e209d39SAndroid Build Coastguard Worker 57*0e209d39SAndroid Build Coastguard Worker // When calling ToExponential with a requested_digits 58*0e209d39SAndroid Build Coastguard Worker // parameter > kMaxExponentialDigits then the function returns false. 59*0e209d39SAndroid Build Coastguard Worker static const int kMaxExponentialDigits = 120; 60*0e209d39SAndroid Build Coastguard Worker 61*0e209d39SAndroid Build Coastguard Worker // When calling ToPrecision with a requested_digits 62*0e209d39SAndroid Build Coastguard Worker // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits 63*0e209d39SAndroid Build Coastguard Worker // then the function returns false. 64*0e209d39SAndroid Build Coastguard Worker static const int kMinPrecisionDigits = 1; 65*0e209d39SAndroid Build Coastguard Worker static const int kMaxPrecisionDigits = 120; 66*0e209d39SAndroid Build Coastguard Worker 67*0e209d39SAndroid Build Coastguard Worker // The maximal number of digits that are needed to emit a double in base 10. 68*0e209d39SAndroid Build Coastguard Worker // A higher precision can be achieved by using more digits, but the shortest 69*0e209d39SAndroid Build Coastguard Worker // accurate representation of any double will never use more digits than 70*0e209d39SAndroid Build Coastguard Worker // kBase10MaximalLength. 71*0e209d39SAndroid Build Coastguard Worker // Note that DoubleToAscii null-terminates its input. So the given buffer 72*0e209d39SAndroid Build Coastguard Worker // should be at least kBase10MaximalLength + 1 characters long. 73*0e209d39SAndroid Build Coastguard Worker static const int kBase10MaximalLength = 17; 74*0e209d39SAndroid Build Coastguard Worker 75*0e209d39SAndroid Build Coastguard Worker // The maximal number of digits that are needed to emit a single in base 10. 76*0e209d39SAndroid Build Coastguard Worker // A higher precision can be achieved by using more digits, but the shortest 77*0e209d39SAndroid Build Coastguard Worker // accurate representation of any single will never use more digits than 78*0e209d39SAndroid Build Coastguard Worker // kBase10MaximalLengthSingle. 79*0e209d39SAndroid Build Coastguard Worker static const int kBase10MaximalLengthSingle = 9; 80*0e209d39SAndroid Build Coastguard Worker 81*0e209d39SAndroid Build Coastguard Worker // The length of the longest string that 'ToShortest' can produce when the 82*0e209d39SAndroid Build Coastguard Worker // converter is instantiated with EcmaScript defaults (see 83*0e209d39SAndroid Build Coastguard Worker // 'EcmaScriptConverter') 84*0e209d39SAndroid Build Coastguard Worker // This value does not include the trailing '\0' character. 85*0e209d39SAndroid Build Coastguard Worker // This amount of characters is needed for negative values that hit the 86*0e209d39SAndroid Build Coastguard Worker // 'decimal_in_shortest_low' limit. For example: "-0.0000033333333333333333" 87*0e209d39SAndroid Build Coastguard Worker static const int kMaxCharsEcmaScriptShortest = 25; 88*0e209d39SAndroid Build Coastguard Worker 89*0e209d39SAndroid Build Coastguard Worker #if 0 // not needed for ICU 90*0e209d39SAndroid Build Coastguard Worker enum Flags { 91*0e209d39SAndroid Build Coastguard Worker NO_FLAGS = 0, 92*0e209d39SAndroid Build Coastguard Worker EMIT_POSITIVE_EXPONENT_SIGN = 1, 93*0e209d39SAndroid Build Coastguard Worker EMIT_TRAILING_DECIMAL_POINT = 2, 94*0e209d39SAndroid Build Coastguard Worker EMIT_TRAILING_ZERO_AFTER_POINT = 4, 95*0e209d39SAndroid Build Coastguard Worker UNIQUE_ZERO = 8, 96*0e209d39SAndroid Build Coastguard Worker NO_TRAILING_ZERO = 16, 97*0e209d39SAndroid Build Coastguard Worker EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL = 32, 98*0e209d39SAndroid Build Coastguard Worker EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL = 64 99*0e209d39SAndroid Build Coastguard Worker }; 100*0e209d39SAndroid Build Coastguard Worker 101*0e209d39SAndroid Build Coastguard Worker // Flags should be a bit-or combination of the possible Flags-enum. 102*0e209d39SAndroid Build Coastguard Worker // - NO_FLAGS: no special flags. 103*0e209d39SAndroid Build Coastguard Worker // - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent 104*0e209d39SAndroid Build Coastguard Worker // form, emits a '+' for positive exponents. Example: 1.2e+2. 105*0e209d39SAndroid Build Coastguard Worker // - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is 106*0e209d39SAndroid Build Coastguard Worker // converted into decimal format then a trailing decimal point is appended. 107*0e209d39SAndroid Build Coastguard Worker // Example: 2345.0 is converted to "2345.". 108*0e209d39SAndroid Build Coastguard Worker // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point 109*0e209d39SAndroid Build Coastguard Worker // emits a trailing '0'-character. This flag requires the 110*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_DECIMAL_POINT flag. 111*0e209d39SAndroid Build Coastguard Worker // Example: 2345.0 is converted to "2345.0". 112*0e209d39SAndroid Build Coastguard Worker // - UNIQUE_ZERO: "-0.0" is converted to "0.0". 113*0e209d39SAndroid Build Coastguard Worker // - NO_TRAILING_ZERO: Trailing zeros are removed from the fractional portion 114*0e209d39SAndroid Build Coastguard Worker // of the result in precision mode. Matches printf's %g. 115*0e209d39SAndroid Build Coastguard Worker // When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is 116*0e209d39SAndroid Build Coastguard Worker // preserved. 117*0e209d39SAndroid Build Coastguard Worker // - EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL: when the input number has 118*0e209d39SAndroid Build Coastguard Worker // exactly one significant digit and is converted into exponent form then a 119*0e209d39SAndroid Build Coastguard Worker // trailing decimal point is appended to the significand in shortest mode 120*0e209d39SAndroid Build Coastguard Worker // or in precision mode with one requested digit. 121*0e209d39SAndroid Build Coastguard Worker // - EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL: in addition to a trailing 122*0e209d39SAndroid Build Coastguard Worker // decimal point emits a trailing '0'-character. This flag requires the 123*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag. 124*0e209d39SAndroid Build Coastguard Worker // 125*0e209d39SAndroid Build Coastguard Worker // Infinity symbol and nan_symbol provide the string representation for these 126*0e209d39SAndroid Build Coastguard Worker // special values. If the string is nullptr and the special value is encountered 127*0e209d39SAndroid Build Coastguard Worker // then the conversion functions return false. 128*0e209d39SAndroid Build Coastguard Worker // 129*0e209d39SAndroid Build Coastguard Worker // The exponent_character is used in exponential representations. It is 130*0e209d39SAndroid Build Coastguard Worker // usually 'e' or 'E'. 131*0e209d39SAndroid Build Coastguard Worker // 132*0e209d39SAndroid Build Coastguard Worker // When converting to the shortest representation the converter will 133*0e209d39SAndroid Build Coastguard Worker // represent input numbers in decimal format if they are in the interval 134*0e209d39SAndroid Build Coastguard Worker // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[ 135*0e209d39SAndroid Build Coastguard Worker // (lower boundary included, greater boundary excluded). 136*0e209d39SAndroid Build Coastguard Worker // Example: with decimal_in_shortest_low = -6 and 137*0e209d39SAndroid Build Coastguard Worker // decimal_in_shortest_high = 21: 138*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.000001) -> "0.000001" 139*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.0000001) -> "1e-7" 140*0e209d39SAndroid Build Coastguard Worker // ToShortest(111111111111111111111.0) -> "111111111111111110000" 141*0e209d39SAndroid Build Coastguard Worker // ToShortest(100000000000000000000.0) -> "100000000000000000000" 142*0e209d39SAndroid Build Coastguard Worker // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" 143*0e209d39SAndroid Build Coastguard Worker // 144*0e209d39SAndroid Build Coastguard Worker // When converting to precision mode the converter may add 145*0e209d39SAndroid Build Coastguard Worker // max_leading_padding_zeroes before returning the number in exponential 146*0e209d39SAndroid Build Coastguard Worker // format. 147*0e209d39SAndroid Build Coastguard Worker // Example with max_leading_padding_zeroes_in_precision_mode = 6. 148*0e209d39SAndroid Build Coastguard Worker // ToPrecision(0.0000012345, 2) -> "0.0000012" 149*0e209d39SAndroid Build Coastguard Worker // ToPrecision(0.00000012345, 2) -> "1.2e-7" 150*0e209d39SAndroid Build Coastguard Worker // Similarly the converter may add up to 151*0e209d39SAndroid Build Coastguard Worker // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid 152*0e209d39SAndroid Build Coastguard Worker // returning an exponential representation. A zero added by the 153*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. 154*0e209d39SAndroid Build Coastguard Worker // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: 155*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "230" 156*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. 157*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. 158*0e209d39SAndroid Build Coastguard Worker // 159*0e209d39SAndroid Build Coastguard Worker // When converting numbers with exactly one significant digit to exponent 160*0e209d39SAndroid Build Coastguard Worker // form in shortest mode or in precision mode with one requested digit, the 161*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT flags have 162*0e209d39SAndroid Build Coastguard Worker // no effect. Use the EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag to 163*0e209d39SAndroid Build Coastguard Worker // append a decimal point in this case and the 164*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL flag to also append a 165*0e209d39SAndroid Build Coastguard Worker // '0'-character in this case. 166*0e209d39SAndroid Build Coastguard Worker // Example with decimal_in_shortest_low = 0: 167*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.0009) -> "9e-4" 168*0e209d39SAndroid Build Coastguard Worker // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL deactivated. 169*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.0009) -> "9.e-4" 170*0e209d39SAndroid Build Coastguard Worker // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated. 171*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.0009) -> "9.0e-4" 172*0e209d39SAndroid Build Coastguard Worker // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated and 173*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL activated. 174*0e209d39SAndroid Build Coastguard Worker // 175*0e209d39SAndroid Build Coastguard Worker // The min_exponent_width is used for exponential representations. 176*0e209d39SAndroid Build Coastguard Worker // The converter adds leading '0's to the exponent until the exponent 177*0e209d39SAndroid Build Coastguard Worker // is at least min_exponent_width digits long. 178*0e209d39SAndroid Build Coastguard Worker // The min_exponent_width is clamped to 5. 179*0e209d39SAndroid Build Coastguard Worker // As such, the exponent may never have more than 5 digits in total. 180*0e209d39SAndroid Build Coastguard Worker DoubleToStringConverter(int flags, 181*0e209d39SAndroid Build Coastguard Worker const char* infinity_symbol, 182*0e209d39SAndroid Build Coastguard Worker const char* nan_symbol, 183*0e209d39SAndroid Build Coastguard Worker char exponent_character, 184*0e209d39SAndroid Build Coastguard Worker int decimal_in_shortest_low, 185*0e209d39SAndroid Build Coastguard Worker int decimal_in_shortest_high, 186*0e209d39SAndroid Build Coastguard Worker int max_leading_padding_zeroes_in_precision_mode, 187*0e209d39SAndroid Build Coastguard Worker int max_trailing_padding_zeroes_in_precision_mode, 188*0e209d39SAndroid Build Coastguard Worker int min_exponent_width = 0) 189*0e209d39SAndroid Build Coastguard Worker : flags_(flags), 190*0e209d39SAndroid Build Coastguard Worker infinity_symbol_(infinity_symbol), 191*0e209d39SAndroid Build Coastguard Worker nan_symbol_(nan_symbol), 192*0e209d39SAndroid Build Coastguard Worker exponent_character_(exponent_character), 193*0e209d39SAndroid Build Coastguard Worker decimal_in_shortest_low_(decimal_in_shortest_low), 194*0e209d39SAndroid Build Coastguard Worker decimal_in_shortest_high_(decimal_in_shortest_high), 195*0e209d39SAndroid Build Coastguard Worker max_leading_padding_zeroes_in_precision_mode_( 196*0e209d39SAndroid Build Coastguard Worker max_leading_padding_zeroes_in_precision_mode), 197*0e209d39SAndroid Build Coastguard Worker max_trailing_padding_zeroes_in_precision_mode_( 198*0e209d39SAndroid Build Coastguard Worker max_trailing_padding_zeroes_in_precision_mode), 199*0e209d39SAndroid Build Coastguard Worker min_exponent_width_(min_exponent_width) { 200*0e209d39SAndroid Build Coastguard Worker // When 'trailing zero after the point' is set, then 'trailing point' 201*0e209d39SAndroid Build Coastguard Worker // must be set too. 202*0e209d39SAndroid Build Coastguard Worker DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) || 203*0e209d39SAndroid Build Coastguard Worker !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0)); 204*0e209d39SAndroid Build Coastguard Worker } 205*0e209d39SAndroid Build Coastguard Worker 206*0e209d39SAndroid Build Coastguard Worker // Returns a converter following the EcmaScript specification. 207*0e209d39SAndroid Build Coastguard Worker // 208*0e209d39SAndroid Build Coastguard Worker // Flags: UNIQUE_ZERO and EMIT_POSITIVE_EXPONENT_SIGN. 209*0e209d39SAndroid Build Coastguard Worker // Special values: "Infinity" and "NaN". 210*0e209d39SAndroid Build Coastguard Worker // Lower case 'e' for exponential values. 211*0e209d39SAndroid Build Coastguard Worker // decimal_in_shortest_low: -6 212*0e209d39SAndroid Build Coastguard Worker // decimal_in_shortest_high: 21 213*0e209d39SAndroid Build Coastguard Worker // max_leading_padding_zeroes_in_precision_mode: 6 214*0e209d39SAndroid Build Coastguard Worker // max_trailing_padding_zeroes_in_precision_mode: 0 215*0e209d39SAndroid Build Coastguard Worker static const DoubleToStringConverter& EcmaScriptConverter(); 216*0e209d39SAndroid Build Coastguard Worker 217*0e209d39SAndroid Build Coastguard Worker // Computes the shortest string of digits that correctly represent the input 218*0e209d39SAndroid Build Coastguard Worker // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high 219*0e209d39SAndroid Build Coastguard Worker // (see constructor) it then either returns a decimal representation, or an 220*0e209d39SAndroid Build Coastguard Worker // exponential representation. 221*0e209d39SAndroid Build Coastguard Worker // Example with decimal_in_shortest_low = -6, 222*0e209d39SAndroid Build Coastguard Worker // decimal_in_shortest_high = 21, 223*0e209d39SAndroid Build Coastguard Worker // EMIT_POSITIVE_EXPONENT_SIGN activated, and 224*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_DECIMAL_POINT deactivated: 225*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.000001) -> "0.000001" 226*0e209d39SAndroid Build Coastguard Worker // ToShortest(0.0000001) -> "1e-7" 227*0e209d39SAndroid Build Coastguard Worker // ToShortest(111111111111111111111.0) -> "111111111111111110000" 228*0e209d39SAndroid Build Coastguard Worker // ToShortest(100000000000000000000.0) -> "100000000000000000000" 229*0e209d39SAndroid Build Coastguard Worker // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" 230*0e209d39SAndroid Build Coastguard Worker // 231*0e209d39SAndroid Build Coastguard Worker // Note: the conversion may round the output if the returned string 232*0e209d39SAndroid Build Coastguard Worker // is accurate enough to uniquely identify the input-number. 233*0e209d39SAndroid Build Coastguard Worker // For example the most precise representation of the double 9e59 equals 234*0e209d39SAndroid Build Coastguard Worker // "899999999999999918767229449717619953810131273674690656206848", but 235*0e209d39SAndroid Build Coastguard Worker // the converter will return the shorter (but still correct) "9e59". 236*0e209d39SAndroid Build Coastguard Worker // 237*0e209d39SAndroid Build Coastguard Worker // Returns true if the conversion succeeds. The conversion always succeeds 238*0e209d39SAndroid Build Coastguard Worker // except when the input value is special and no infinity_symbol or 239*0e209d39SAndroid Build Coastguard Worker // nan_symbol has been given to the constructor. 240*0e209d39SAndroid Build Coastguard Worker // 241*0e209d39SAndroid Build Coastguard Worker // The length of the longest result is the maximum of the length of the 242*0e209d39SAndroid Build Coastguard Worker // following string representations (each with possible examples): 243*0e209d39SAndroid Build Coastguard Worker // - NaN and negative infinity: "NaN", "-Infinity", "-inf". 244*0e209d39SAndroid Build Coastguard Worker // - -10^(decimal_in_shortest_high - 1): 245*0e209d39SAndroid Build Coastguard Worker // "-100000000000000000000", "-1000000000000000.0" 246*0e209d39SAndroid Build Coastguard Worker // - the longest string in range [0; -10^decimal_in_shortest_low]. Generally, 247*0e209d39SAndroid Build Coastguard Worker // this string is 3 + kBase10MaximalLength - decimal_in_shortest_low. 248*0e209d39SAndroid Build Coastguard Worker // (Sign, '0', decimal point, padding zeroes for decimal_in_shortest_low, 249*0e209d39SAndroid Build Coastguard Worker // and the significant digits). 250*0e209d39SAndroid Build Coastguard Worker // "-0.0000033333333333333333", "-0.0012345678901234567" 251*0e209d39SAndroid Build Coastguard Worker // - the longest exponential representation. (A negative number with 252*0e209d39SAndroid Build Coastguard Worker // kBase10MaximalLength significant digits). 253*0e209d39SAndroid Build Coastguard Worker // "-1.7976931348623157e+308", "-1.7976931348623157E308" 254*0e209d39SAndroid Build Coastguard Worker // In addition, the buffer must be able to hold the trailing '\0' character. 255*0e209d39SAndroid Build Coastguard Worker bool ToShortest(double value, StringBuilder* result_builder) const { 256*0e209d39SAndroid Build Coastguard Worker return ToShortestIeeeNumber(value, result_builder, SHORTEST); 257*0e209d39SAndroid Build Coastguard Worker } 258*0e209d39SAndroid Build Coastguard Worker 259*0e209d39SAndroid Build Coastguard Worker // Same as ToShortest, but for single-precision floats. 260*0e209d39SAndroid Build Coastguard Worker bool ToShortestSingle(float value, StringBuilder* result_builder) const { 261*0e209d39SAndroid Build Coastguard Worker return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE); 262*0e209d39SAndroid Build Coastguard Worker } 263*0e209d39SAndroid Build Coastguard Worker 264*0e209d39SAndroid Build Coastguard Worker 265*0e209d39SAndroid Build Coastguard Worker // Computes a decimal representation with a fixed number of digits after the 266*0e209d39SAndroid Build Coastguard Worker // decimal point. The last emitted digit is rounded. 267*0e209d39SAndroid Build Coastguard Worker // 268*0e209d39SAndroid Build Coastguard Worker // Examples: 269*0e209d39SAndroid Build Coastguard Worker // ToFixed(3.12, 1) -> "3.1" 270*0e209d39SAndroid Build Coastguard Worker // ToFixed(3.1415, 3) -> "3.142" 271*0e209d39SAndroid Build Coastguard Worker // ToFixed(1234.56789, 4) -> "1234.5679" 272*0e209d39SAndroid Build Coastguard Worker // ToFixed(1.23, 5) -> "1.23000" 273*0e209d39SAndroid Build Coastguard Worker // ToFixed(0.1, 4) -> "0.1000" 274*0e209d39SAndroid Build Coastguard Worker // ToFixed(1e30, 2) -> "1000000000000000019884624838656.00" 275*0e209d39SAndroid Build Coastguard Worker // ToFixed(0.1, 30) -> "0.100000000000000005551115123126" 276*0e209d39SAndroid Build Coastguard Worker // ToFixed(0.1, 17) -> "0.10000000000000001" 277*0e209d39SAndroid Build Coastguard Worker // 278*0e209d39SAndroid Build Coastguard Worker // If requested_digits equals 0, then the tail of the result depends on 279*0e209d39SAndroid Build Coastguard Worker // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT. 280*0e209d39SAndroid Build Coastguard Worker // Examples, for requested_digits == 0, 281*0e209d39SAndroid Build Coastguard Worker // let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be 282*0e209d39SAndroid Build Coastguard Worker // - false and false: then 123.45 -> 123 283*0e209d39SAndroid Build Coastguard Worker // 0.678 -> 1 284*0e209d39SAndroid Build Coastguard Worker // - true and false: then 123.45 -> 123. 285*0e209d39SAndroid Build Coastguard Worker // 0.678 -> 1. 286*0e209d39SAndroid Build Coastguard Worker // - true and true: then 123.45 -> 123.0 287*0e209d39SAndroid Build Coastguard Worker // 0.678 -> 1.0 288*0e209d39SAndroid Build Coastguard Worker // 289*0e209d39SAndroid Build Coastguard Worker // Returns true if the conversion succeeds. The conversion always succeeds 290*0e209d39SAndroid Build Coastguard Worker // except for the following cases: 291*0e209d39SAndroid Build Coastguard Worker // - the input value is special and no infinity_symbol or nan_symbol has 292*0e209d39SAndroid Build Coastguard Worker // been provided to the constructor, 293*0e209d39SAndroid Build Coastguard Worker // - 'value' > 10^kMaxFixedDigitsBeforePoint, or 294*0e209d39SAndroid Build Coastguard Worker // - 'requested_digits' > kMaxFixedDigitsAfterPoint. 295*0e209d39SAndroid Build Coastguard Worker // The last two conditions imply that the result for non-special values never 296*0e209d39SAndroid Build Coastguard Worker // contains more than 297*0e209d39SAndroid Build Coastguard Worker // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters 298*0e209d39SAndroid Build Coastguard Worker // (one additional character for the sign, and one for the decimal point). 299*0e209d39SAndroid Build Coastguard Worker // In addition, the buffer must be able to hold the trailing '\0' character. 300*0e209d39SAndroid Build Coastguard Worker bool ToFixed(double value, 301*0e209d39SAndroid Build Coastguard Worker int requested_digits, 302*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder) const; 303*0e209d39SAndroid Build Coastguard Worker 304*0e209d39SAndroid Build Coastguard Worker // Computes a representation in exponential format with requested_digits 305*0e209d39SAndroid Build Coastguard Worker // after the decimal point. The last emitted digit is rounded. 306*0e209d39SAndroid Build Coastguard Worker // If requested_digits equals -1, then the shortest exponential representation 307*0e209d39SAndroid Build Coastguard Worker // is computed. 308*0e209d39SAndroid Build Coastguard Worker // 309*0e209d39SAndroid Build Coastguard Worker // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and 310*0e209d39SAndroid Build Coastguard Worker // exponent_character set to 'e'. 311*0e209d39SAndroid Build Coastguard Worker // ToExponential(3.12, 1) -> "3.1e0" 312*0e209d39SAndroid Build Coastguard Worker // ToExponential(5.0, 3) -> "5.000e0" 313*0e209d39SAndroid Build Coastguard Worker // ToExponential(0.001, 2) -> "1.00e-3" 314*0e209d39SAndroid Build Coastguard Worker // ToExponential(3.1415, -1) -> "3.1415e0" 315*0e209d39SAndroid Build Coastguard Worker // ToExponential(3.1415, 4) -> "3.1415e0" 316*0e209d39SAndroid Build Coastguard Worker // ToExponential(3.1415, 3) -> "3.142e0" 317*0e209d39SAndroid Build Coastguard Worker // ToExponential(123456789000000, 3) -> "1.235e14" 318*0e209d39SAndroid Build Coastguard Worker // ToExponential(1000000000000000019884624838656.0, -1) -> "1e30" 319*0e209d39SAndroid Build Coastguard Worker // ToExponential(1000000000000000019884624838656.0, 32) -> 320*0e209d39SAndroid Build Coastguard Worker // "1.00000000000000001988462483865600e30" 321*0e209d39SAndroid Build Coastguard Worker // ToExponential(1234, 0) -> "1e3" 322*0e209d39SAndroid Build Coastguard Worker // 323*0e209d39SAndroid Build Coastguard Worker // Returns true if the conversion succeeds. The conversion always succeeds 324*0e209d39SAndroid Build Coastguard Worker // except for the following cases: 325*0e209d39SAndroid Build Coastguard Worker // - the input value is special and no infinity_symbol or nan_symbol has 326*0e209d39SAndroid Build Coastguard Worker // been provided to the constructor, 327*0e209d39SAndroid Build Coastguard Worker // - 'requested_digits' > kMaxExponentialDigits. 328*0e209d39SAndroid Build Coastguard Worker // 329*0e209d39SAndroid Build Coastguard Worker // The last condition implies that the result never contains more than 330*0e209d39SAndroid Build Coastguard Worker // kMaxExponentialDigits + 8 characters (the sign, the digit before the 331*0e209d39SAndroid Build Coastguard Worker // decimal point, the decimal point, the exponent character, the 332*0e209d39SAndroid Build Coastguard Worker // exponent's sign, and at most 3 exponent digits). 333*0e209d39SAndroid Build Coastguard Worker // In addition, the buffer must be able to hold the trailing '\0' character. 334*0e209d39SAndroid Build Coastguard Worker bool ToExponential(double value, 335*0e209d39SAndroid Build Coastguard Worker int requested_digits, 336*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder) const; 337*0e209d39SAndroid Build Coastguard Worker 338*0e209d39SAndroid Build Coastguard Worker 339*0e209d39SAndroid Build Coastguard Worker // Computes 'precision' leading digits of the given 'value' and returns them 340*0e209d39SAndroid Build Coastguard Worker // either in exponential or decimal format, depending on 341*0e209d39SAndroid Build Coastguard Worker // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the 342*0e209d39SAndroid Build Coastguard Worker // constructor). 343*0e209d39SAndroid Build Coastguard Worker // The last computed digit is rounded. 344*0e209d39SAndroid Build Coastguard Worker // 345*0e209d39SAndroid Build Coastguard Worker // Example with max_leading_padding_zeroes_in_precision_mode = 6. 346*0e209d39SAndroid Build Coastguard Worker // ToPrecision(0.0000012345, 2) -> "0.0000012" 347*0e209d39SAndroid Build Coastguard Worker // ToPrecision(0.00000012345, 2) -> "1.2e-7" 348*0e209d39SAndroid Build Coastguard Worker // Similarly the converter may add up to 349*0e209d39SAndroid Build Coastguard Worker // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid 350*0e209d39SAndroid Build Coastguard Worker // returning an exponential representation. A zero added by the 351*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. 352*0e209d39SAndroid Build Coastguard Worker // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: 353*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "230" 354*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. 355*0e209d39SAndroid Build Coastguard Worker // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. 356*0e209d39SAndroid Build Coastguard Worker // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no 357*0e209d39SAndroid Build Coastguard Worker // EMIT_TRAILING_ZERO_AFTER_POINT: 358*0e209d39SAndroid Build Coastguard Worker // ToPrecision(123450.0, 6) -> "123450" 359*0e209d39SAndroid Build Coastguard Worker // ToPrecision(123450.0, 5) -> "123450" 360*0e209d39SAndroid Build Coastguard Worker // ToPrecision(123450.0, 4) -> "123500" 361*0e209d39SAndroid Build Coastguard Worker // ToPrecision(123450.0, 3) -> "123000" 362*0e209d39SAndroid Build Coastguard Worker // ToPrecision(123450.0, 2) -> "1.2e5" 363*0e209d39SAndroid Build Coastguard Worker // 364*0e209d39SAndroid Build Coastguard Worker // Returns true if the conversion succeeds. The conversion always succeeds 365*0e209d39SAndroid Build Coastguard Worker // except for the following cases: 366*0e209d39SAndroid Build Coastguard Worker // - the input value is special and no infinity_symbol or nan_symbol has 367*0e209d39SAndroid Build Coastguard Worker // been provided to the constructor, 368*0e209d39SAndroid Build Coastguard Worker // - precision < kMinPericisionDigits 369*0e209d39SAndroid Build Coastguard Worker // - precision > kMaxPrecisionDigits 370*0e209d39SAndroid Build Coastguard Worker // 371*0e209d39SAndroid Build Coastguard Worker // The last condition implies that the result never contains more than 372*0e209d39SAndroid Build Coastguard Worker // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the 373*0e209d39SAndroid Build Coastguard Worker // exponent character, the exponent's sign, and at most 3 exponent digits). 374*0e209d39SAndroid Build Coastguard Worker // In addition, the buffer must be able to hold the trailing '\0' character. 375*0e209d39SAndroid Build Coastguard Worker bool ToPrecision(double value, 376*0e209d39SAndroid Build Coastguard Worker int precision, 377*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder) const; 378*0e209d39SAndroid Build Coastguard Worker #endif // not needed for ICU 379*0e209d39SAndroid Build Coastguard Worker 380*0e209d39SAndroid Build Coastguard Worker enum DtoaMode { 381*0e209d39SAndroid Build Coastguard Worker // Produce the shortest correct representation. 382*0e209d39SAndroid Build Coastguard Worker // For example the output of 0.299999999999999988897 is (the less accurate 383*0e209d39SAndroid Build Coastguard Worker // but correct) 0.3. 384*0e209d39SAndroid Build Coastguard Worker SHORTEST, 385*0e209d39SAndroid Build Coastguard Worker // Same as SHORTEST, but for single-precision floats. 386*0e209d39SAndroid Build Coastguard Worker SHORTEST_SINGLE, 387*0e209d39SAndroid Build Coastguard Worker // Produce a fixed number of digits after the decimal point. 388*0e209d39SAndroid Build Coastguard Worker // For instance fixed(0.1, 4) becomes 0.1000 389*0e209d39SAndroid Build Coastguard Worker // If the input number is big, the output will be big. 390*0e209d39SAndroid Build Coastguard Worker FIXED, 391*0e209d39SAndroid Build Coastguard Worker // Fixed number of digits (independent of the decimal point). 392*0e209d39SAndroid Build Coastguard Worker PRECISION 393*0e209d39SAndroid Build Coastguard Worker }; 394*0e209d39SAndroid Build Coastguard Worker 395*0e209d39SAndroid Build Coastguard Worker // Converts the given double 'v' to digit characters. 'v' must not be NaN, 396*0e209d39SAndroid Build Coastguard Worker // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also 397*0e209d39SAndroid Build Coastguard Worker // applies to 'v' after it has been casted to a single-precision float. That 398*0e209d39SAndroid Build Coastguard Worker // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or 399*0e209d39SAndroid Build Coastguard Worker // -Infinity. 400*0e209d39SAndroid Build Coastguard Worker // 401*0e209d39SAndroid Build Coastguard Worker // The result should be interpreted as buffer * 10^(point-length). 402*0e209d39SAndroid Build Coastguard Worker // 403*0e209d39SAndroid Build Coastguard Worker // The digits are written to the buffer in the platform's charset, which is 404*0e209d39SAndroid Build Coastguard Worker // often UTF-8 (with ASCII-range digits) but may be another charset, such 405*0e209d39SAndroid Build Coastguard Worker // as EBCDIC. 406*0e209d39SAndroid Build Coastguard Worker // 407*0e209d39SAndroid Build Coastguard Worker // The output depends on the given mode: 408*0e209d39SAndroid Build Coastguard Worker // - SHORTEST: produce the least amount of digits for which the internal 409*0e209d39SAndroid Build Coastguard Worker // identity requirement is still satisfied. If the digits are printed 410*0e209d39SAndroid Build Coastguard Worker // (together with the correct exponent) then reading this number will give 411*0e209d39SAndroid Build Coastguard Worker // 'v' again. The buffer will choose the representation that is closest to 412*0e209d39SAndroid Build Coastguard Worker // 'v'. If there are two at the same distance, than the one farther away 413*0e209d39SAndroid Build Coastguard Worker // from 0 is chosen (halfway cases - ending with 5 - are rounded up). 414*0e209d39SAndroid Build Coastguard Worker // In this mode the 'requested_digits' parameter is ignored. 415*0e209d39SAndroid Build Coastguard Worker // - SHORTEST_SINGLE: same as SHORTEST but with single-precision. 416*0e209d39SAndroid Build Coastguard Worker // - FIXED: produces digits necessary to print a given number with 417*0e209d39SAndroid Build Coastguard Worker // 'requested_digits' digits after the decimal point. The produced digits 418*0e209d39SAndroid Build Coastguard Worker // might be too short in which case the caller has to fill the remainder 419*0e209d39SAndroid Build Coastguard Worker // with '0's. 420*0e209d39SAndroid Build Coastguard Worker // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2. 421*0e209d39SAndroid Build Coastguard Worker // Halfway cases are rounded towards +/-Infinity (away from 0). The call 422*0e209d39SAndroid Build Coastguard Worker // toFixed(0.15, 2) thus returns buffer="2", point=0. 423*0e209d39SAndroid Build Coastguard Worker // The returned buffer may contain digits that would be truncated from the 424*0e209d39SAndroid Build Coastguard Worker // shortest representation of the input. 425*0e209d39SAndroid Build Coastguard Worker // - PRECISION: produces 'requested_digits' where the first digit is not '0'. 426*0e209d39SAndroid Build Coastguard Worker // Even though the length of produced digits usually equals 427*0e209d39SAndroid Build Coastguard Worker // 'requested_digits', the function is allowed to return fewer digits, in 428*0e209d39SAndroid Build Coastguard Worker // which case the caller has to fill the missing digits with '0's. 429*0e209d39SAndroid Build Coastguard Worker // Halfway cases are again rounded away from 0. 430*0e209d39SAndroid Build Coastguard Worker // DoubleToAscii expects the given buffer to be big enough to hold all 431*0e209d39SAndroid Build Coastguard Worker // digits and a terminating null-character. In SHORTEST-mode it expects a 432*0e209d39SAndroid Build Coastguard Worker // buffer of at least kBase10MaximalLength + 1. In all other modes the 433*0e209d39SAndroid Build Coastguard Worker // requested_digits parameter and the padding-zeroes limit the size of the 434*0e209d39SAndroid Build Coastguard Worker // output. Don't forget the decimal point, the exponent character and the 435*0e209d39SAndroid Build Coastguard Worker // terminating null-character when computing the maximal output size. 436*0e209d39SAndroid Build Coastguard Worker // The given length is only used in debug mode to ensure the buffer is big 437*0e209d39SAndroid Build Coastguard Worker // enough. 438*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: Export this as U_I18N_API for unit tests. 439*0e209d39SAndroid Build Coastguard Worker static void U_I18N_API DoubleToAscii(double v, 440*0e209d39SAndroid Build Coastguard Worker DtoaMode mode, 441*0e209d39SAndroid Build Coastguard Worker int requested_digits, 442*0e209d39SAndroid Build Coastguard Worker char* buffer, 443*0e209d39SAndroid Build Coastguard Worker int buffer_length, 444*0e209d39SAndroid Build Coastguard Worker bool* sign, 445*0e209d39SAndroid Build Coastguard Worker int* length, 446*0e209d39SAndroid Build Coastguard Worker int* point); 447*0e209d39SAndroid Build Coastguard Worker 448*0e209d39SAndroid Build Coastguard Worker #if 0 // not needed for ICU 449*0e209d39SAndroid Build Coastguard Worker private: 450*0e209d39SAndroid Build Coastguard Worker // Implementation for ToShortest and ToShortestSingle. 451*0e209d39SAndroid Build Coastguard Worker bool ToShortestIeeeNumber(double value, 452*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder, 453*0e209d39SAndroid Build Coastguard Worker DtoaMode mode) const; 454*0e209d39SAndroid Build Coastguard Worker 455*0e209d39SAndroid Build Coastguard Worker // If the value is a special value (NaN or Infinity) constructs the 456*0e209d39SAndroid Build Coastguard Worker // corresponding string using the configured infinity/nan-symbol. 457*0e209d39SAndroid Build Coastguard Worker // If either of them is nullptr or the value is not special then the 458*0e209d39SAndroid Build Coastguard Worker // function returns false. 459*0e209d39SAndroid Build Coastguard Worker bool HandleSpecialValues(double value, StringBuilder* result_builder) const; 460*0e209d39SAndroid Build Coastguard Worker // Constructs an exponential representation (i.e. 1.234e56). 461*0e209d39SAndroid Build Coastguard Worker // The given exponent assumes a decimal point after the first decimal digit. 462*0e209d39SAndroid Build Coastguard Worker void CreateExponentialRepresentation(const char* decimal_digits, 463*0e209d39SAndroid Build Coastguard Worker int length, 464*0e209d39SAndroid Build Coastguard Worker int exponent, 465*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder) const; 466*0e209d39SAndroid Build Coastguard Worker // Creates a decimal representation (i.e 1234.5678). 467*0e209d39SAndroid Build Coastguard Worker void CreateDecimalRepresentation(const char* decimal_digits, 468*0e209d39SAndroid Build Coastguard Worker int length, 469*0e209d39SAndroid Build Coastguard Worker int decimal_point, 470*0e209d39SAndroid Build Coastguard Worker int digits_after_point, 471*0e209d39SAndroid Build Coastguard Worker StringBuilder* result_builder) const; 472*0e209d39SAndroid Build Coastguard Worker 473*0e209d39SAndroid Build Coastguard Worker const int flags_; 474*0e209d39SAndroid Build Coastguard Worker const char* const infinity_symbol_; 475*0e209d39SAndroid Build Coastguard Worker const char* const nan_symbol_; 476*0e209d39SAndroid Build Coastguard Worker const char exponent_character_; 477*0e209d39SAndroid Build Coastguard Worker const int decimal_in_shortest_low_; 478*0e209d39SAndroid Build Coastguard Worker const int decimal_in_shortest_high_; 479*0e209d39SAndroid Build Coastguard Worker const int max_leading_padding_zeroes_in_precision_mode_; 480*0e209d39SAndroid Build Coastguard Worker const int max_trailing_padding_zeroes_in_precision_mode_; 481*0e209d39SAndroid Build Coastguard Worker const int min_exponent_width_; 482*0e209d39SAndroid Build Coastguard Worker #endif // not needed for ICU 483*0e209d39SAndroid Build Coastguard Worker 484*0e209d39SAndroid Build Coastguard Worker DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); 485*0e209d39SAndroid Build Coastguard Worker }; 486*0e209d39SAndroid Build Coastguard Worker 487*0e209d39SAndroid Build Coastguard Worker } // namespace double_conversion 488*0e209d39SAndroid Build Coastguard Worker 489*0e209d39SAndroid Build Coastguard Worker // ICU PATCH: Close ICU namespace 490*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END 491*0e209d39SAndroid Build Coastguard Worker 492*0e209d39SAndroid Build Coastguard Worker #endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ 493*0e209d39SAndroid Build Coastguard Worker #endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING 494