![]() |
|
|||
File indexing completed on 2025-08-28 08:27:14
0001 // Copyright 2012 the V8 project authors. All rights reserved. 0002 // Redistribution and use in source and binary forms, with or without 0003 // modification, are permitted provided that the following conditions are 0004 // met: 0005 // 0006 // * Redistributions of source code must retain the above copyright 0007 // notice, this list of conditions and the following disclaimer. 0008 // * Redistributions in binary form must reproduce the above 0009 // copyright notice, this list of conditions and the following 0010 // disclaimer in the documentation and/or other materials provided 0011 // with the distribution. 0012 // * Neither the name of Google Inc. nor the names of its 0013 // contributors may be used to endorse or promote products derived 0014 // from this software without specific prior written permission. 0015 // 0016 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0017 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0018 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0019 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0020 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0021 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0022 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0023 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0024 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0026 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0027 0028 #ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ 0029 #define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ 0030 0031 #include "utils.h" 0032 0033 namespace arrow_vendored { 0034 namespace double_conversion { 0035 0036 class DoubleToStringConverter { 0037 public: 0038 // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint 0039 // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the 0040 // function returns false. 0041 static const int kMaxFixedDigitsBeforePoint = 60; 0042 static const int kMaxFixedDigitsAfterPoint = 100; 0043 0044 // When calling ToExponential with a requested_digits 0045 // parameter > kMaxExponentialDigits then the function returns false. 0046 static const int kMaxExponentialDigits = 120; 0047 0048 // When calling ToPrecision with a requested_digits 0049 // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits 0050 // then the function returns false. 0051 static const int kMinPrecisionDigits = 1; 0052 static const int kMaxPrecisionDigits = 120; 0053 0054 // The maximal number of digits that are needed to emit a double in base 10. 0055 // A higher precision can be achieved by using more digits, but the shortest 0056 // accurate representation of any double will never use more digits than 0057 // kBase10MaximalLength. 0058 // Note that DoubleToAscii null-terminates its input. So the given buffer 0059 // should be at least kBase10MaximalLength + 1 characters long. 0060 static const int kBase10MaximalLength = 17; 0061 0062 // The maximal number of digits that are needed to emit a single in base 10. 0063 // A higher precision can be achieved by using more digits, but the shortest 0064 // accurate representation of any single will never use more digits than 0065 // kBase10MaximalLengthSingle. 0066 static const int kBase10MaximalLengthSingle = 9; 0067 0068 // The length of the longest string that 'ToShortest' can produce when the 0069 // converter is instantiated with EcmaScript defaults (see 0070 // 'EcmaScriptConverter') 0071 // This value does not include the trailing '\0' character. 0072 // This amount of characters is needed for negative values that hit the 0073 // 'decimal_in_shortest_low' limit. For example: "-0.0000033333333333333333" 0074 static const int kMaxCharsEcmaScriptShortest = 25; 0075 0076 enum Flags { 0077 NO_FLAGS = 0, 0078 EMIT_POSITIVE_EXPONENT_SIGN = 1, 0079 EMIT_TRAILING_DECIMAL_POINT = 2, 0080 EMIT_TRAILING_ZERO_AFTER_POINT = 4, 0081 UNIQUE_ZERO = 8, 0082 NO_TRAILING_ZERO = 16, 0083 EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL = 32, 0084 EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL = 64 0085 }; 0086 0087 // Flags should be a bit-or combination of the possible Flags-enum. 0088 // - NO_FLAGS: no special flags. 0089 // - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent 0090 // form, emits a '+' for positive exponents. Example: 1.2e+2. 0091 // - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is 0092 // converted into decimal format then a trailing decimal point is appended. 0093 // Example: 2345.0 is converted to "2345.". 0094 // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point 0095 // emits a trailing '0'-character. This flag requires the 0096 // EMIT_TRAILING_DECIMAL_POINT flag. 0097 // Example: 2345.0 is converted to "2345.0". 0098 // - UNIQUE_ZERO: "-0.0" is converted to "0.0". 0099 // - NO_TRAILING_ZERO: Trailing zeros are removed from the fractional portion 0100 // of the result in precision mode. Matches printf's %g. 0101 // When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is 0102 // preserved. 0103 // - EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL: when the input number has 0104 // exactly one significant digit and is converted into exponent form then a 0105 // trailing decimal point is appended to the significand in shortest mode 0106 // or in precision mode with one requested digit. 0107 // - EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL: in addition to a trailing 0108 // decimal point emits a trailing '0'-character. This flag requires the 0109 // EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag. 0110 // 0111 // Infinity symbol and nan_symbol provide the string representation for these 0112 // special values. If the string is NULL and the special value is encountered 0113 // then the conversion functions return false. 0114 // 0115 // The exponent_character is used in exponential representations. It is 0116 // usually 'e' or 'E'. 0117 // 0118 // When converting to the shortest representation the converter will 0119 // represent input numbers in decimal format if they are in the interval 0120 // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[ 0121 // (lower boundary included, greater boundary excluded). 0122 // Example: with decimal_in_shortest_low = -6 and 0123 // decimal_in_shortest_high = 21: 0124 // ToShortest(0.000001) -> "0.000001" 0125 // ToShortest(0.0000001) -> "1e-7" 0126 // ToShortest(111111111111111111111.0) -> "111111111111111110000" 0127 // ToShortest(100000000000000000000.0) -> "100000000000000000000" 0128 // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" 0129 // 0130 // When converting to precision mode the converter may add 0131 // max_leading_padding_zeroes before returning the number in exponential 0132 // format. 0133 // Example with max_leading_padding_zeroes_in_precision_mode = 6. 0134 // ToPrecision(0.0000012345, 2) -> "0.0000012" 0135 // ToPrecision(0.00000012345, 2) -> "1.2e-7" 0136 // Similarly the converter may add up to 0137 // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid 0138 // returning an exponential representation. A zero added by the 0139 // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. 0140 // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: 0141 // ToPrecision(230.0, 2) -> "230" 0142 // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. 0143 // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. 0144 // 0145 // When converting numbers with exactly one significant digit to exponent 0146 // form in shortest mode or in precision mode with one requested digit, the 0147 // EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT flags have 0148 // no effect. Use the EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag to 0149 // append a decimal point in this case and the 0150 // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL flag to also append a 0151 // '0'-character in this case. 0152 // Example with decimal_in_shortest_low = 0: 0153 // ToShortest(0.0009) -> "9e-4" 0154 // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL deactivated. 0155 // ToShortest(0.0009) -> "9.e-4" 0156 // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated. 0157 // ToShortest(0.0009) -> "9.0e-4" 0158 // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated and 0159 // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL activated. 0160 // 0161 // The min_exponent_width is used for exponential representations. 0162 // The converter adds leading '0's to the exponent until the exponent 0163 // is at least min_exponent_width digits long. 0164 // The min_exponent_width is clamped to 5. 0165 // As such, the exponent may never have more than 5 digits in total. 0166 DoubleToStringConverter(int flags, 0167 const char* infinity_symbol, 0168 const char* nan_symbol, 0169 char exponent_character, 0170 int decimal_in_shortest_low, 0171 int decimal_in_shortest_high, 0172 int max_leading_padding_zeroes_in_precision_mode, 0173 int max_trailing_padding_zeroes_in_precision_mode, 0174 int min_exponent_width = 0) 0175 : flags_(flags), 0176 infinity_symbol_(infinity_symbol), 0177 nan_symbol_(nan_symbol), 0178 exponent_character_(exponent_character), 0179 decimal_in_shortest_low_(decimal_in_shortest_low), 0180 decimal_in_shortest_high_(decimal_in_shortest_high), 0181 max_leading_padding_zeroes_in_precision_mode_( 0182 max_leading_padding_zeroes_in_precision_mode), 0183 max_trailing_padding_zeroes_in_precision_mode_( 0184 max_trailing_padding_zeroes_in_precision_mode), 0185 min_exponent_width_(min_exponent_width) { 0186 // When 'trailing zero after the point' is set, then 'trailing point' 0187 // must be set too. 0188 DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) || 0189 !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0)); 0190 } 0191 0192 // Returns a converter following the EcmaScript specification. 0193 // 0194 // Flags: UNIQUE_ZERO and EMIT_POSITIVE_EXPONENT_SIGN. 0195 // Special values: "Infinity" and "NaN". 0196 // Lower case 'e' for exponential values. 0197 // decimal_in_shortest_low: -6 0198 // decimal_in_shortest_high: 21 0199 // max_leading_padding_zeroes_in_precision_mode: 6 0200 // max_trailing_padding_zeroes_in_precision_mode: 0 0201 static const DoubleToStringConverter& EcmaScriptConverter(); 0202 0203 // Computes the shortest string of digits that correctly represent the input 0204 // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high 0205 // (see constructor) it then either returns a decimal representation, or an 0206 // exponential representation. 0207 // Example with decimal_in_shortest_low = -6, 0208 // decimal_in_shortest_high = 21, 0209 // EMIT_POSITIVE_EXPONENT_SIGN activated, and 0210 // EMIT_TRAILING_DECIMAL_POINT deactivated: 0211 // ToShortest(0.000001) -> "0.000001" 0212 // ToShortest(0.0000001) -> "1e-7" 0213 // ToShortest(111111111111111111111.0) -> "111111111111111110000" 0214 // ToShortest(100000000000000000000.0) -> "100000000000000000000" 0215 // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" 0216 // 0217 // Note: the conversion may round the output if the returned string 0218 // is accurate enough to uniquely identify the input-number. 0219 // For example the most precise representation of the double 9e59 equals 0220 // "899999999999999918767229449717619953810131273674690656206848", but 0221 // the converter will return the shorter (but still correct) "9e59". 0222 // 0223 // Returns true if the conversion succeeds. The conversion always succeeds 0224 // except when the input value is special and no infinity_symbol or 0225 // nan_symbol has been given to the constructor. 0226 // 0227 // The length of the longest result is the maximum of the length of the 0228 // following string representations (each with possible examples): 0229 // - NaN and negative infinity: "NaN", "-Infinity", "-inf". 0230 // - -10^(decimal_in_shortest_high - 1): 0231 // "-100000000000000000000", "-1000000000000000.0" 0232 // - the longest string in range [0; -10^decimal_in_shortest_low]. Generally, 0233 // this string is 3 + kBase10MaximalLength - decimal_in_shortest_low. 0234 // (Sign, '0', decimal point, padding zeroes for decimal_in_shortest_low, 0235 // and the significant digits). 0236 // "-0.0000033333333333333333", "-0.0012345678901234567" 0237 // - the longest exponential representation. (A negative number with 0238 // kBase10MaximalLength significant digits). 0239 // "-1.7976931348623157e+308", "-1.7976931348623157E308" 0240 // In addition, the buffer must be able to hold the trailing '\0' character. 0241 bool ToShortest(double value, StringBuilder* result_builder) const { 0242 return ToShortestIeeeNumber(value, result_builder, SHORTEST); 0243 } 0244 0245 // Same as ToShortest, but for single-precision floats. 0246 bool ToShortestSingle(float value, StringBuilder* result_builder) const { 0247 return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE); 0248 } 0249 0250 0251 // Computes a decimal representation with a fixed number of digits after the 0252 // decimal point. The last emitted digit is rounded. 0253 // 0254 // Examples: 0255 // ToFixed(3.12, 1) -> "3.1" 0256 // ToFixed(3.1415, 3) -> "3.142" 0257 // ToFixed(1234.56789, 4) -> "1234.5679" 0258 // ToFixed(1.23, 5) -> "1.23000" 0259 // ToFixed(0.1, 4) -> "0.1000" 0260 // ToFixed(1e30, 2) -> "1000000000000000019884624838656.00" 0261 // ToFixed(0.1, 30) -> "0.100000000000000005551115123126" 0262 // ToFixed(0.1, 17) -> "0.10000000000000001" 0263 // 0264 // If requested_digits equals 0, then the tail of the result depends on 0265 // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT. 0266 // Examples, for requested_digits == 0, 0267 // let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be 0268 // - false and false: then 123.45 -> 123 0269 // 0.678 -> 1 0270 // - true and false: then 123.45 -> 123. 0271 // 0.678 -> 1. 0272 // - true and true: then 123.45 -> 123.0 0273 // 0.678 -> 1.0 0274 // 0275 // Returns true if the conversion succeeds. The conversion always succeeds 0276 // except for the following cases: 0277 // - the input value is special and no infinity_symbol or nan_symbol has 0278 // been provided to the constructor, 0279 // - 'value' > 10^kMaxFixedDigitsBeforePoint, or 0280 // - 'requested_digits' > kMaxFixedDigitsAfterPoint. 0281 // The last two conditions imply that the result for non-special values never 0282 // contains more than 0283 // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters 0284 // (one additional character for the sign, and one for the decimal point). 0285 // In addition, the buffer must be able to hold the trailing '\0' character. 0286 bool ToFixed(double value, 0287 int requested_digits, 0288 StringBuilder* result_builder) const; 0289 0290 // Computes a representation in exponential format with requested_digits 0291 // after the decimal point. The last emitted digit is rounded. 0292 // If requested_digits equals -1, then the shortest exponential representation 0293 // is computed. 0294 // 0295 // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and 0296 // exponent_character set to 'e'. 0297 // ToExponential(3.12, 1) -> "3.1e0" 0298 // ToExponential(5.0, 3) -> "5.000e0" 0299 // ToExponential(0.001, 2) -> "1.00e-3" 0300 // ToExponential(3.1415, -1) -> "3.1415e0" 0301 // ToExponential(3.1415, 4) -> "3.1415e0" 0302 // ToExponential(3.1415, 3) -> "3.142e0" 0303 // ToExponential(123456789000000, 3) -> "1.235e14" 0304 // ToExponential(1000000000000000019884624838656.0, -1) -> "1e30" 0305 // ToExponential(1000000000000000019884624838656.0, 32) -> 0306 // "1.00000000000000001988462483865600e30" 0307 // ToExponential(1234, 0) -> "1e3" 0308 // 0309 // Returns true if the conversion succeeds. The conversion always succeeds 0310 // except for the following cases: 0311 // - the input value is special and no infinity_symbol or nan_symbol has 0312 // been provided to the constructor, 0313 // - 'requested_digits' > kMaxExponentialDigits. 0314 // 0315 // The last condition implies that the result never contains more than 0316 // kMaxExponentialDigits + 8 characters (the sign, the digit before the 0317 // decimal point, the decimal point, the exponent character, the 0318 // exponent's sign, and at most 3 exponent digits). 0319 // In addition, the buffer must be able to hold the trailing '\0' character. 0320 bool ToExponential(double value, 0321 int requested_digits, 0322 StringBuilder* result_builder) const; 0323 0324 0325 // Computes 'precision' leading digits of the given 'value' and returns them 0326 // either in exponential or decimal format, depending on 0327 // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the 0328 // constructor). 0329 // The last computed digit is rounded. 0330 // 0331 // Example with max_leading_padding_zeroes_in_precision_mode = 6. 0332 // ToPrecision(0.0000012345, 2) -> "0.0000012" 0333 // ToPrecision(0.00000012345, 2) -> "1.2e-7" 0334 // Similarly the converter may add up to 0335 // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid 0336 // returning an exponential representation. A zero added by the 0337 // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. 0338 // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: 0339 // ToPrecision(230.0, 2) -> "230" 0340 // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. 0341 // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. 0342 // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no 0343 // EMIT_TRAILING_ZERO_AFTER_POINT: 0344 // ToPrecision(123450.0, 6) -> "123450" 0345 // ToPrecision(123450.0, 5) -> "123450" 0346 // ToPrecision(123450.0, 4) -> "123500" 0347 // ToPrecision(123450.0, 3) -> "123000" 0348 // ToPrecision(123450.0, 2) -> "1.2e5" 0349 // 0350 // Returns true if the conversion succeeds. The conversion always succeeds 0351 // except for the following cases: 0352 // - the input value is special and no infinity_symbol or nan_symbol has 0353 // been provided to the constructor, 0354 // - precision < kMinPericisionDigits 0355 // - precision > kMaxPrecisionDigits 0356 // 0357 // The last condition implies that the result never contains more than 0358 // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the 0359 // exponent character, the exponent's sign, and at most 3 exponent digits). 0360 // In addition, the buffer must be able to hold the trailing '\0' character. 0361 bool ToPrecision(double value, 0362 int precision, 0363 StringBuilder* result_builder) const; 0364 0365 enum DtoaMode { 0366 // Produce the shortest correct representation. 0367 // For example the output of 0.299999999999999988897 is (the less accurate 0368 // but correct) 0.3. 0369 SHORTEST, 0370 // Same as SHORTEST, but for single-precision floats. 0371 SHORTEST_SINGLE, 0372 // Produce a fixed number of digits after the decimal point. 0373 // For instance fixed(0.1, 4) becomes 0.1000 0374 // If the input number is big, the output will be big. 0375 FIXED, 0376 // Fixed number of digits (independent of the decimal point). 0377 PRECISION 0378 }; 0379 0380 // Converts the given double 'v' to digit characters. 'v' must not be NaN, 0381 // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also 0382 // applies to 'v' after it has been casted to a single-precision float. That 0383 // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or 0384 // -Infinity. 0385 // 0386 // The result should be interpreted as buffer * 10^(point-length). 0387 // 0388 // The digits are written to the buffer in the platform's charset, which is 0389 // often UTF-8 (with ASCII-range digits) but may be another charset, such 0390 // as EBCDIC. 0391 // 0392 // The output depends on the given mode: 0393 // - SHORTEST: produce the least amount of digits for which the internal 0394 // identity requirement is still satisfied. If the digits are printed 0395 // (together with the correct exponent) then reading this number will give 0396 // 'v' again. The buffer will choose the representation that is closest to 0397 // 'v'. If there are two at the same distance, than the one farther away 0398 // from 0 is chosen (halfway cases - ending with 5 - are rounded up). 0399 // In this mode the 'requested_digits' parameter is ignored. 0400 // - SHORTEST_SINGLE: same as SHORTEST but with single-precision. 0401 // - FIXED: produces digits necessary to print a given number with 0402 // 'requested_digits' digits after the decimal point. The produced digits 0403 // might be too short in which case the caller has to fill the remainder 0404 // with '0's. 0405 // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2. 0406 // Halfway cases are rounded towards +/-Infinity (away from 0). The call 0407 // toFixed(0.15, 2) thus returns buffer="2", point=0. 0408 // The returned buffer may contain digits that would be truncated from the 0409 // shortest representation of the input. 0410 // - PRECISION: produces 'requested_digits' where the first digit is not '0'. 0411 // Even though the length of produced digits usually equals 0412 // 'requested_digits', the function is allowed to return fewer digits, in 0413 // which case the caller has to fill the missing digits with '0's. 0414 // Halfway cases are again rounded away from 0. 0415 // DoubleToAscii expects the given buffer to be big enough to hold all 0416 // digits and a terminating null-character. In SHORTEST-mode it expects a 0417 // buffer of at least kBase10MaximalLength + 1. In all other modes the 0418 // requested_digits parameter and the padding-zeroes limit the size of the 0419 // output. Don't forget the decimal point, the exponent character and the 0420 // terminating null-character when computing the maximal output size. 0421 // The given length is only used in debug mode to ensure the buffer is big 0422 // enough. 0423 static void DoubleToAscii(double v, 0424 DtoaMode mode, 0425 int requested_digits, 0426 char* buffer, 0427 int buffer_length, 0428 bool* sign, 0429 int* length, 0430 int* point); 0431 0432 private: 0433 // Implementation for ToShortest and ToShortestSingle. 0434 bool ToShortestIeeeNumber(double value, 0435 StringBuilder* result_builder, 0436 DtoaMode mode) const; 0437 0438 // If the value is a special value (NaN or Infinity) constructs the 0439 // corresponding string using the configured infinity/nan-symbol. 0440 // If either of them is NULL or the value is not special then the 0441 // function returns false. 0442 bool HandleSpecialValues(double value, StringBuilder* result_builder) const; 0443 // Constructs an exponential representation (i.e. 1.234e56). 0444 // The given exponent assumes a decimal point after the first decimal digit. 0445 void CreateExponentialRepresentation(const char* decimal_digits, 0446 int length, 0447 int exponent, 0448 StringBuilder* result_builder) const; 0449 // Creates a decimal representation (i.e 1234.5678). 0450 void CreateDecimalRepresentation(const char* decimal_digits, 0451 int length, 0452 int decimal_point, 0453 int digits_after_point, 0454 StringBuilder* result_builder) const; 0455 0456 const int flags_; 0457 const char* const infinity_symbol_; 0458 const char* const nan_symbol_; 0459 const char exponent_character_; 0460 const int decimal_in_shortest_low_; 0461 const int decimal_in_shortest_high_; 0462 const int max_leading_padding_zeroes_in_precision_mode_; 0463 const int max_trailing_padding_zeroes_in_precision_mode_; 0464 const int min_exponent_width_; 0465 0466 DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); 0467 }; 0468 0469 } // namespace double_conversion 0470 } // namespace arrow_vendored 0471 0472 #endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |