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)
409 if(isNull(arg1) || isNull(arg2))
410 throw std::invalid_argument(
"Provided argument is Null.");
425 <Mantissa, Exponent>& left,
428 <Mantissa, Exponent>& right)
430 if(isNull(left) && isNull(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)
556 if(isNull(left) && isNull(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_B3_BOE_MESSAGING_NAMESPACE_END
std::ostream & operator<<(std::ostream &stream, const FixedPointDecimal< Mantissa, Exponent > &value)
Serializes into a stream.
A real number with a floating exponent.
void toStr(std::string &str, const FixedPointDecimal< Mantissa, Exponent > &number)
Serializes a fixed-point decimal into a string.
#define ONIXS_B3_BOE_NOTHROW
#define ONIXS_B3_BOE_NORETURN
#define ONIXS_B3_BOE_EXPORTED
Exponent exponent() const noexcept
#define ONIXS_B3_BOE_CONSTEXPR
MantissaType Mantissa
Mantissa component type.
#define ONIXS_B3_BOE_NODISCARD
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator>(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_BEGIN
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.
bool fromStr(Decimal &value, const std::string &str) noexcept
Deserializes a decimal number from the given text presentation.
#define ONIXS_B3_BOE_COLDPATH
char Char
Character type alias.
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.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator!=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
EnableIf< details::IsDecimal< DecimalT >::value, DecimalT >::type convert(const Decimal &number)
Convert the decimal in to a different one.
EnableIf< details::AreBothDecimals< Decimal1, Decimal2 >::value, bool >::type operator<=(const Decimal1 &left, const Decimal2 &right)
Compares two decimals.
#define ONIXS_B3_BOE_PURE
Decimal quantize(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.