37 template <
class MantissaType,
class ExponentType >
40 MantissaType mantissa_;
41 ExponentType exponent_;
50 typedef MantissaType FirstArgType;
52 typedef ExponentType SecondArgType;
65 Size =
sizeof(Mantissa) +
sizeof(Exponent)
95 : mantissa_(other.mantissa_)
96 , exponent_(other.exponent_)
115 mantissa_ = other.mantissa_;
116 exponent_ = other.exponent_;
123 template<
class OtherMantissa,
class OtherExponent>
125 : mantissa_(other.mantissa())
126 , exponent_(other.exponent())
131 template <
class OtherMantissa,
class OtherExponent>
133 : mantissa_(other.mantissa())
134 , exponent_(other.exponent())
149 mantissa_ = other.mantissa();
150 exponent_ = other.exponent();
163 mantissa_ = other.mantissa();
164 exponent_ = other.exponent();
174 std::memcpy(addr, &mantissa_,
sizeof(mantissa_));
175 addr = advanceByBytes(addr,
sizeof(mantissa_));
177 std::memcpy(addr, &exponent_,
sizeof(exponent_));
190 MantissaType mantissa_;
199 typedef MantissaType FirstArgType;
212 Size =
sizeof(Mantissa)
231 : mantissa_(mantissa)
237 : mantissa_(other.mantissa_)
256 mantissa_ = other.mantissa_;
266 std::memcpy(addr, &mantissa_,
sizeof(mantissa_));
Exponent exponent() const noexcept
ExponentType Exponent
Exponent component type.
constexpr FloatingPointDecimal(const FloatingPointDecimal &other) noexcept
Initializes the instance as a copy of the given one.
A real number with a floating exponent.
#define ONIXS_CONFLATEDTCP_NOTHROW
constexpr FixedPointDecimal(Mantissa mantissa) noexcept
Explicitly initializes the instance from the mantissa value.
constexpr FixedPointDecimal() noexcept
Default (zero) initialization.
void serialize(void *addr) const noexcept
Serializes to the given data buffer.
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_BEGIN
std::string toString() const
ExponentType Exponent
Exponent component type.
#define ONIXS_CONFLATEDTCP_MESSAGING_MDP_NAMESPACE_END
Mantissa mantissa() const noexcept
void serialize(void *addr) const noexcept
Serialize to the given data buffer.
#define ONIXS_CONFLATEDTCP_CONSTEXPR
#define ONIXS_CONFLATEDTCP_NODISCARD
std::string toString() const
std::string toStr(const FloatingPointDecimal< Mantissa, Exponent > &)
Serializes a floating-point decimal into a string.
FloatingPointDecimal(const FloatingPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Initializes the instance from the floating point decimal.
constexpr FixedPointDecimal(const FixedPointDecimal &other) noexcept
Initializes the instance as a copy of the given one.
Mantissa mantissa() const noexcept
FloatingPointDecimal(const FixedPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
Initializes the instance from the fixed point decimal.
MantissaType Mantissa
Mantissa component type.
constexpr FloatingPointDecimal() noexcept
Default (zero) initialization.
Exponent exponent() const noexcept
constexpr FloatingPointDecimal(Mantissa mantissa, Exponent exponent) noexcept
Explicitly initializes the instance from the mantissa and exponent values.
MantissaType Mantissa
Mantissa component type.