36 void throwCannotQuantizeOrConvert();
74 template <
class MantissaType>
83 if(static_cast<MantissaType>(
84 (std::numeric_limits<MantissaType>::max)()) >= res)
86 return static_cast<MantissaType
>(res);
89 throwCannotQuantizeOrConvert();
103 quantizedMantissa<MantissaType>(number, ExponentType()));
115 if(static_cast<MantissaType>(
116 (std::numeric_limits<MantissaType>::max)()) < number.
mantissa())
118 throwCannotQuantizeOrConvert();
123 static_cast<MantissaType
>(number.
mantissa()),
138 typename EnableIf<details::IsDecimal<DecimalT>::value, DecimalT>::type
178 return (right < left);
189 return (right <= left);
260 <Mantissa, Exponent>& number)
280 std::ostream& stream,
283 <Mantissa, Exponent>& value)
289 return stream << str;
304 <Mantissa, Exponent>& number)
363 return stream << str;
375 std::ostream& stream,
378 <Mantissa, Exponent>& value)
384 return stream << str;
394 const Decimal1& arg1,
const Decimal2& arg2)
397 throw std::invalid_argument(
"Provided argument is Null.");
412 <Mantissa, Exponent>& left,
415 <Mantissa, Exponent>& right)
435 <Mantissa, Exponent>& left,
438 <Mantissa, Exponent>& right)
440 return !(left == right);
455 <Mantissa, Exponent>& left,
458 <Mantissa, Exponent>& right)
460 checkAgsValid(left, right);
477 <Mantissa, Exponent>& left,
480 <Mantissa, Exponent>& right)
482 checkAgsValid(left, right);
499 <Mantissa, Exponent>& left,
502 <Mantissa, Exponent>& right)
504 checkAgsValid(left, right);
521 <Mantissa, Exponent>& left,
524 <Mantissa, Exponent>& right)
526 checkAgsValid(left, right);
539 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
541 const Decimal1& left,
const Decimal2& right)
543 bool isNullLeft =
isNull(left);
544 bool isNullRight =
isNull(right);
546 if (isNullLeft && isNullRight)
560 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
562 const Decimal1& left,
const Decimal2& right)
564 return !(left == right);
575 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
577 const Decimal1& left,
const Decimal2& right)
579 checkAgsValid(left, right);
592 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
594 const Decimal1& left,
const Decimal2& right)
596 checkAgsValid(left, right);
609 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
611 const Decimal1& left,
const Decimal2& right)
613 checkAgsValid(left, right);
626 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
628 const Decimal1& left,
const Decimal2& right)
630 checkAgsValid(left, right);
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator>=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator<=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
A real number with a floating exponent.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator==(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
#define ONIXS_CONFLATEDTCP_NOTHROW
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator!=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
bool fromStr(Decimal &value, const std::string &str) noexcept
Deserializes a decimal number from the given text presentation.
FloatingPointDecimal< Int64, Int32 > Decimal
Universal decimal type.
#define ONIXS_CONFLATEDTCP_EXPORTED
void toStr(std::string &str, const FixedPointDecimal< Mantissa, Exponent > &number)
Serializes a fixed-point decimal into a string.
EnableIf< details::IsDecimal< DecimalT >::value, DecimalT >::type convert(const Decimal &number)
Convert the decimal in to a different one.
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_BEGIN
std::ostream & operator<<(std::ostream &stream, const FixedPointDecimal< Mantissa, Exponent > &value)
Serializes into a stream.
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_END
#define ONIXS_CONFLATEDTCP_NORETURN
#define ONIXS_CONFLATEDTCP_PURE
Mantissa mantissa() const noexcept
#define ONIXS_CONFLATEDTCP_CONSTEXPR
#define ONIXS_CONFLATEDTCP_NODISCARD
#define ONIXS_CONFLATEDTCP_COLDPATH
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator<(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
MantissaType Mantissa
Mantissa component type.
Exponent exponent() const noexcept
MantissaType quantizedMantissa(const Decimal &operand, Int32 exponent)
Quantize so its exponent is the same as that of provided value.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator>(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
char Char
Character type alias.
bool isNull(const PRICE9 &value) noexcept
Decimal quantize(const Decimal &operand, Int32 exponent)
Quantize so its exponent is the same as that of provided value.