43 #if defined (_MSC_VER) 44 typedef signed long long Int64;
45 typedef unsigned long long UInt64;
46 #elif defined (__GNUC__) 48 #if defined (__LP64__) 49 typedef signed long Int64;
50 typedef unsigned long UInt64;
52 typedef signed long long Int64;
53 typedef unsigned long long UInt64;
70 DecimalMantissa mantissa = 0,
71 DecimalExponent exponent = 0);
77 explicit Decimal (Double value);
82 Decimal (Double value,
size_t precision);
88 DecimalMantissa mantissa()
const;
91 void mantissa (DecimalMantissa);
94 DecimalExponent exponent()
const;
97 void exponent (DecimalExponent);
108 operator Int32()
const;
118 operator Int64()
const;
123 operator UInt64()
const;
133 bool toNumber (Int32&)
const;
138 bool toNumber (UInt32&)
const;
143 bool toNumber (Int64&)
const;
148 bool toNumber (UInt64&)
const;
152 bool toNumber (Double&)
const;
155 void toString (std::string&)
const;
158 std::string toString()
const;
185 DecimalMantissa mantissa_;
188 DecimalExponent exponent_;
207 DecimalMantissa value)
222 DecimalExponent value)
235 throw std::domain_error (
236 "Cannot cast value to target type. ");
247 throw std::domain_error (
248 "Cannot cast value to target type. ");
252 Decimal::operator Int64()
const 259 throw std::domain_error (
260 "Cannot cast value to target type. ");
264 Decimal::operator UInt64()
const 271 throw std::domain_error (
272 "Cannot cast value to target type. ");
283 throw std::domain_error (
284 "Cannot cast value to target type. ");
291 std::string presentation;
bool operator>=(const Decimal &l, const Decimal &r)
bool operator==(const FieldValueRef &ref, const std::string &str)
std::ostream & operator<<(std::ostream &os, const Message &message)
std::string toString() const
Returns text presentation of decimal.
static bool tryParse(const char *buffer, size_t bufferSize, Decimal &)
DecimalMantissa mantissa() const
Returns mantissa part of decimal.
Decimal type for better precision.
bool operator<=(const Decimal &l, const Decimal &r)
DecimalExponent exponent() const
Returns exponent part of decimal.
bool operator<(const Decimal &l, const Decimal &r)
bool operator!=(const FieldValueRef &ref, const std::string &str)
bool toNumber(Int32 &) const
bool operator>(const Decimal &l, const Decimal &r)
Helper class for conversion from string to number.