Differential D3143 Diff 14286 ps/trunk/libraries/source/spidermonkey/include-win32-debug/double-conversion/double-conversion.h
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/source/spidermonkey/include-win32-debug/double-conversion/double-conversion.h
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | public: | ||||
// The maximal number of digits that are needed to emit a double in base 10. | // The maximal number of digits that are needed to emit a double in base 10. | ||||
// A higher precision can be achieved by using more digits, but the shortest | // A higher precision can be achieved by using more digits, but the shortest | ||||
// accurate representation of any double will never use more digits than | // accurate representation of any double will never use more digits than | ||||
// kBase10MaximalLength. | // kBase10MaximalLength. | ||||
// Note that DoubleToAscii null-terminates its input. So the given buffer | // Note that DoubleToAscii null-terminates its input. So the given buffer | ||||
// should be at least kBase10MaximalLength + 1 characters long. | // should be at least kBase10MaximalLength + 1 characters long. | ||||
static const MFBT_DATA int kBase10MaximalLength = 17; | static const MFBT_DATA int kBase10MaximalLength = 17; | ||||
// Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or | // Converts the given double 'v' to digit characters. 'v' must not be NaN, | ||||
// -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v' | // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also | ||||
// after it has been casted to a single-precision float. That is, in this | // applies to 'v' after it has been casted to a single-precision float. That | ||||
// mode static_cast<float>(v) must not be NaN, +Infinity or -Infinity. | // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or | ||||
// -Infinity. | |||||
// | // | ||||
// The result should be interpreted as buffer * 10^(point-length). | // The result should be interpreted as buffer * 10^(point-length). | ||||
// | // | ||||
// The digits are written to the buffer in the platform's charset, which is | |||||
// often UTF-8 (with ASCII-range digits) but may be another charset, such | |||||
// as EBCDIC. | |||||
// | |||||
// The output depends on the given mode: | // The output depends on the given mode: | ||||
// - SHORTEST: produce the least amount of digits for which the internal | // - SHORTEST: produce the least amount of digits for which the internal | ||||
// identity requirement is still satisfied. If the digits are printed | // identity requirement is still satisfied. If the digits are printed | ||||
// (together with the correct exponent) then reading this number will give | // (together with the correct exponent) then reading this number will give | ||||
// 'v' again. The buffer will choose the representation that is closest to | // 'v' again. The buffer will choose the representation that is closest to | ||||
// 'v'. If there are two at the same distance, than the one farther away | // 'v'. If there are two at the same distance, than the one farther away | ||||
// from 0 is chosen (halfway cases - ending with 5 - are rounded up). | // from 0 is chosen (halfway cases - ending with 5 - are rounded up). | ||||
// In this mode the 'requested_digits' parameter is ignored. | // In this mode the 'requested_digits' parameter is ignored. | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | private: | ||||
const char* const infinity_symbol_; | const char* const infinity_symbol_; | ||||
const char* const nan_symbol_; | const char* const nan_symbol_; | ||||
const char exponent_character_; | const char exponent_character_; | ||||
const int decimal_in_shortest_low_; | const int decimal_in_shortest_low_; | ||||
const int decimal_in_shortest_high_; | const int decimal_in_shortest_high_; | ||||
const int max_leading_padding_zeroes_in_precision_mode_; | const int max_leading_padding_zeroes_in_precision_mode_; | ||||
const int max_trailing_padding_zeroes_in_precision_mode_; | const int max_trailing_padding_zeroes_in_precision_mode_; | ||||
DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); | DC_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); | ||||
}; | }; | ||||
class StringToDoubleConverter { | class StringToDoubleConverter { | ||||
public: | public: | ||||
// Enumeration for allowing octals and ignoring junk when converting | // Enumeration for allowing octals and ignoring junk when converting | ||||
// strings to numbers. | // strings to numbers. | ||||
enum Flags { | enum Flags { | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | private: | ||||
const char* const nan_symbol_; | const char* const nan_symbol_; | ||||
template <class Iterator> | template <class Iterator> | ||||
double StringToIeee(Iterator start_pointer, | double StringToIeee(Iterator start_pointer, | ||||
int length, | int length, | ||||
bool read_as_double, | bool read_as_double, | ||||
int* processed_characters_count) const; | int* processed_characters_count) const; | ||||
DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); | DC_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); | ||||
}; | }; | ||||
} // namespace double_conversion | } // namespace double_conversion | ||||
#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ | #endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ |
Wildfire Games · Phabricator