34 void throwCannotQuantizeOrConvert();
72 template <
class MantissaType>
81 if(static_cast<MantissaType>(
82 (std::numeric_limits<MantissaType>::max)()) >= res)
84 return static_cast<MantissaType
>(res);
87 throwCannotQuantizeOrConvert();
101 quantizedMantissa<MantissaType>(number, ExponentType()));
113 if(static_cast<MantissaType>(
114 (std::numeric_limits<MantissaType>::max)()) < number.
mantissa())
116 throwCannotQuantizeOrConvert();
121 static_cast<MantissaType
>(number.
mantissa()),
136 typename EnableIf<details::IsDecimal<DecimalT>::value, DecimalT>::type
180 return !(right < left);
191 return (right < left);
202 return (right <= left);
273 <Mantissa, Exponent>& number)
293 std::ostream& stream,
296 <Mantissa, Exponent>& value)
302 return stream << str;
317 <Mantissa, Exponent>& number)
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)
448 <Mantissa, Exponent>& left,
451 <Mantissa, Exponent>& right)
453 return !(left == right);
468 <Mantissa, Exponent>& left,
471 <Mantissa, Exponent>& right)
473 checkAgsValid(left, right);
490 <Mantissa, Exponent>& left,
493 <Mantissa, Exponent>& right)
495 checkAgsValid(left, right);
512 <Mantissa, Exponent>& left,
515 <Mantissa, Exponent>& right)
517 checkAgsValid(left, right);
534 <Mantissa, Exponent>& left,
537 <Mantissa, Exponent>& right)
539 checkAgsValid(left, right);
552 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
554 const Decimal1& left,
const Decimal2& right)
570 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
572 const Decimal1& left,
const Decimal2& right)
574 return !(left == right);
585 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
587 const Decimal1& left,
const Decimal2& right)
589 checkAgsValid(left, right);
602 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
604 const Decimal1& left,
const Decimal2& right)
606 checkAgsValid(left, right);
619 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
621 const Decimal1& left,
const Decimal2& right)
623 checkAgsValid(left, right);
636 typename EnableIf<details::AreBothDecimals<Decimal1, Decimal2>::value,
bool>::type
638 const Decimal1& left,
const Decimal2& right)
640 checkAgsValid(left, right);
#define ONIXS_ILINK3_CONSTEXPR
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.
char Char
Character type alias.
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.
A real number with a floating exponent.
#define ONIXS_ILINK3_PURE
#define ONIXS_ILINK3_NORETURN
std::ostream & operator<<(std::ostream &stream, const FixedPointDecimal< Mantissa, Exponent > &value)
Serializes into a stream.
MantissaType Mantissa
Mantissa component type.
bool isNull(const Decimal32NULL &value) noexcept
Mantissa mantissa() const noexcept
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.
Decimal quantize(const Decimal &operand, Int32 exponent)
Quantize so its exponent is the same as that of provided value.
bool fromStr(Decimal &value, const std::string &str) noexcept
Deserializes a decimal number from the given text presentation.
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
#define ONIXS_ILINK3_EXPORTED
Exponent exponent() const noexcept
#define ONIXS_ILINK3_COLDPATH
EnableIf< details::IsDecimal< DecimalT >::value, DecimalT >::type convert(const Decimal &number)
Convert the decimal in to a different one.
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
void toStr(std::string &str, const FixedPointDecimal< Mantissa, Exponent > &number)
Serializes a fixed-point decimal into a string.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator<=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
#define ONIXS_ILINK3_NODISCARD
#define ONIXS_ILINK3_NOTHROW
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator>(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.