OLD | NEW |
1 /**************************************************************** | 1 /**************************************************************** |
2 * | 2 * |
3 * The author of this software is David M. Gay. | 3 * The author of this software is David M. Gay. |
4 * | 4 * |
5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. | 5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. |
6 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. |
7 * | 7 * |
8 * Permission to use, copy, modify, and distribute this software for any | 8 * Permission to use, copy, modify, and distribute this software for any |
9 * purpose without fee is hereby granted, provided that this entire notice | 9 * purpose without fee is hereby granted, provided that this entire notice |
10 * is included in all copies of any software which is or includes a copy | 10 * is included in all copies of any software which is or includes a copy |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 } | 1285 } |
1286 | 1286 |
1287 const char* numberToFixedWidthString(double d, unsigned decimalPlaces, NumberToS
tringBuffer buffer) | 1287 const char* numberToFixedWidthString(double d, unsigned decimalPlaces, NumberToS
tringBuffer buffer) |
1288 { | 1288 { |
1289 // Mimic String::format("%.[precision]f", ...), but use dtoas rounding facil
ities. | 1289 // Mimic String::format("%.[precision]f", ...), but use dtoas rounding facil
ities. |
1290 // "f": Signed value having the form [ – ]dddd.dddd, where dddd is one or mo
re decimal digits. | 1290 // "f": Signed value having the form [ – ]dddd.dddd, where dddd is one or mo
re decimal digits. |
1291 // The number of digits before the decimal point depends on the magnitude of
the number, and | 1291 // The number of digits before the decimal point depends on the magnitude of
the number, and |
1292 // the number of digits after the decimal point depends on the requested pre
cision. | 1292 // the number of digits after the decimal point depends on the requested pre
cision. |
1293 // "precision": The precision value specifies the number of digits after the
decimal point. | 1293 // "precision": The precision value specifies the number of digits after the
decimal point. |
1294 // If a decimal point appears, at least one digit appears before it. | 1294 // If a decimal point appears, at least one digit appears before it. |
1295 // The value is rounded to the appropriate number of digits. | 1295 // The value is rounded to the appropriate number of digits. |
1296 double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength)
; | 1296 double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength)
; |
1297 const double_conversion::DoubleToStringConverter& converter = double_convers
ion::DoubleToStringConverter::EcmaScriptConverter(); | 1297 const double_conversion::DoubleToStringConverter& converter = double_convers
ion::DoubleToStringConverter::EcmaScriptConverter(); |
1298 converter.ToFixed(d, decimalPlaces, &builder); | 1298 converter.ToFixed(d, decimalPlaces, &builder); |
1299 return builder.Finalize(); | 1299 return builder.Finalize(); |
1300 } | 1300 } |
1301 | 1301 |
1302 namespace Internal { | 1302 namespace Internal { |
1303 | 1303 |
1304 double parseDoubleFromLongString(const UChar* string, size_t length, size_t& par
sedLength) | 1304 double parseDoubleFromLongString(const UChar* string, size_t length, size_t& par
sedLength) |
1305 { | 1305 { |
1306 Vector<LChar> conversionBuffer(length); | 1306 Vector<LChar> conversionBuffer(length); |
1307 for (size_t i = 0; i < length; ++i) | 1307 for (size_t i = 0; i < length; ++i) |
1308 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; | 1308 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; |
1309 return parseDouble(conversionBuffer.data(), length, parsedLength); | 1309 return parseDouble(conversionBuffer.data(), length, parsedLength); |
1310 } | 1310 } |
1311 | 1311 |
1312 } // namespace Internal | 1312 } // namespace Internal |
1313 | 1313 |
1314 } // namespace WTF | 1314 } // namespace WTF |
OLD | NEW |