34void throwCannotQuantizeOrConvert();
72template <
class MantissaType>
81 if(
static_cast<MantissaType
>(
82 (std::numeric_limits<MantissaType>::max)()) >= res)
84 return static_cast<MantissaType
>(res);
87 throwCannotQuantizeOrConvert();
113 if(
static_cast<MantissaType
>(
114 (std::numeric_limits<MantissaType>::max)()) < number.
mantissa())
116 throwCannotQuantizeOrConvert();
121 static_cast<MantissaType
>(number.
mantissa()),
136typename EnableIf<details::IsDecimal<DecimalT>::value, DecimalT>::type
153 return ((left.exponent() == right.exponent()) ? (left.mantissa() == right.mantissa()) : decimalEqual(left, right));
157inline bool operator!=(
158 const Decimal& left,
const Decimal& right)
160 return ((left.exponent() == right.exponent()) ? (left.mantissa() != right.mantissa()) : !decimalEqual(left, right));
170inline bool operator <(
173 return ((left.exponent() == right.exponent()) ? (left.mantissa() < right.mantissa()) : decimalLess(left, right));
177inline bool operator<=(
178 const Decimal& left,
const Decimal& right)
180 return !(right < left);
189 const Decimal& right)
191 return (right < left);
200 const Decimal& right)
202 return (right <= left);
273 <Mantissa, Exponent>& number)
293 std::ostream& stream,
296 <Mantissa, Exponent>& value)
302 return stream << str;
317 <Mantissa, Exponent>& number)
370std::ostream& operator << (std::ostream& stream,
const Decimal& value)
376 return stream << str;
388 std::ostream& stream,
391 <Mantissa, Exponent>& value)
397 return stream << str;
407 const Decimal1& arg1,
const Decimal2& arg2)
410 throw std::invalid_argument(
"Provided argument is Null.");
425 <Mantissa, Exponent>& left,
428 <Mantissa, Exponent>& right)
433 return left.mantissa() == right.mantissa();
448 <Mantissa, Exponent>& left,
451 <Mantissa, Exponent>& right)
453 return !(left == right);
468 <Mantissa, Exponent>& left,
471 <Mantissa, Exponent>& right)
473 checkAgsValid(left, right);
475 return left.mantissa() < right.mantissa();
490 <Mantissa, Exponent>& left,
493 <Mantissa, Exponent>& right)
495 checkAgsValid(left, right);
497 return left.mantissa() > right.mantissa();
512 <Mantissa, Exponent>& left,
515 <Mantissa, Exponent>& right)
517 checkAgsValid(left, right);
519 return left.mantissa() <= right.mantissa();
534 <Mantissa, Exponent>& left,
537 <Mantissa, Exponent>& right)
539 checkAgsValid(left, right);
541 return left.mantissa() >= right.mantissa();
552typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
554 const Decimal1& left,
const Decimal2& right)
570typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
572 const Decimal1& left,
const Decimal2& right)
574 return !(left == right);
585typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
587 const Decimal1& left,
const Decimal2& right)
589 checkAgsValid(left, right);
602typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
604 const Decimal1& left,
const Decimal2& right)
606 checkAgsValid(left, right);
619typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
621 const Decimal1& left,
const Decimal2& right)
623 checkAgsValid(left, right);
636typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
638 const Decimal1& left,
const Decimal2& right)
640 checkAgsValid(left, right);
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_ILINK3_NODISCARD
#define ONIXS_ILINK3_NORETURN
#define ONIXS_ILINK3_EXPORTED
#define ONIXS_ILINK3_CONSTEXPR
#define ONIXS_ILINK3_COLDPATH
#define ONIXS_ILINK3_PURE
#define ONIXS_ILINK3_NOTHROW
A real number with a floating exponent.
Exponent exponent() const noexcept
Mantissa mantissa() const noexcept
std::ostream & operator<<(std::ostream &stream, const FloatingPointDecimal< Mantissa, Exponent > &value)
Serializes into a stream.
FloatingPointDecimal< Int64, Int32 > Decimal
Universal decimal type.
MantissaType quantizedMantissa(const Decimal &operand, Int32 exponent)
Quantize so its exponent is the same as that of provided value.
char Char
Character type alias.
std::string toStr(const FixedPointDecimal< Mantissa, Exponent > &)
Serializes a fixed-point decimal into a string.
bool quantize(const Decimal &operand, Int32 exponent, Decimal &quantized)
Quantize so its exponent is the same as that of provided value.
bool isNull(const Decimal32NULL &value) noexcept
void convert(FixedPointDecimal< MantissaType, ExponentType > &res, const Decimal &number)
bool fromStr(Decimal &, const Char *, size_t) noexcept
Deserializes a decimal number from the given text presentation.