decimal_fast64_t
Description
decimal_fast64_t
has the same ranges of values and representations as decimal64_t
but with greater performance.
The performance changes by being non-IEEE 754 compliant so that the value does not have to be decoded from bits, but is instead directly represented internal to the type.
As is often the case this trades space for time by having greater storage width requirements.
Attribute |
values |
Storage Width |
88 bits |
Precision |
16 decimal digits |
Max exponent |
385 |
Max Value |
9.999999999999999e+385 |
Smallest Normalized Value |
1.000000000000000e-382 |
Smallest Subnormal Value |
Flushed to 0 |
IMPORTANT decimal_fast64_t
does not support subnormal values
#include <boost/decimal/decimal_fast64_t.hpp>
namespace boost {
namespace decimal {
class decimal_fast64_t {
public:
using significand_type = std::uint_fast64_t;
using exponent_type = std::uint_fast16_t;
using biased_exponent_type = std::int32_t;
// Paragraph numbers are from ISO/IEC DTR 24733
// 3.2.3.1 construct/copy/destroy
constexpr decimal_fast64_t() noexcept = default;
// 3.2.2.2 Conversion form floating-point type
template <typename Float>
explicit BOOST_DECIMAL_CXX20_CONSTEXPR decimal_fast64_t(Float val) noexcept;
// 3.2.3.3 Conversion from integral type
template <typename Integer>
explicit constexpr decimal_fast64_t(Integer val) noexcept;
template <typename UnsignedIntegral, typename Integral>
constexpr decimal_fast64_t(UnsignedIntegral coeff, Integral exp, bool sign = false) noexcept;
template <typename SignedIntegral, typename Integral>
constexpr decimal_fast64_t(SignedIntegral coeff, Integral exp) noexcept;
template <typename Integral>
constexpr decimal_fast64_t& operator=(const Integeral& RHS) noexcept;
// 3.2.3.4 Conversion to integral type
// If the value exceeds the range of the integral,
// or is non-finite std::numeric_limits::max() is returned
explicit constexpr operator int() const noexcept;
explicit constexpr operator unsigned() const noexcept;
explicit constexpr operator long() const noexcept;
explicit constexpr operator unsigned long() const noexcept;
explicit constexpr operator long long() const noexcept;
explicit constexpr operator unsigned long long() const noexcept;
// 3.2.3.5 increment and decrement operators:
constexpr decimal_fast64_t& operator++();
constexpr decimal_fast64_t operator++(int);
constexpr decimal_fast64_t& operator--();
constexpr decimal_fast64_t operator--(int);
// 3.2.3.6 compound assignment:
constexpr decimal_fast64_t& operator+=(RHS rhs);
constexpr decimal_fast64_t& operator-=(RHS rhs);
constexpr decimal_fast64_t& operator*=(RHS rhs);
constexpr decimal_fast64_t& operator/=(RHS rhs);
// 3.2.6 Conversion to floating-point type
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator float() const noexcept;
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator double() const noexcept;
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator long double() const noexcept;
// The following are available assuming a C++23 compiler that provides the header <stdfloat>
explicit constexpr operator std::float16_t() const noexcept;
explicit constexpr operator std::float32_t() const noexcept;
explicit constexpr operator std::float64_t() const noexcept;
explicit constexpr operator std::bfloat16_t() const noexcept;
explicit constexpr operator decimal32_t() const noexcept;
explicit constexpr operator decimal128_t() const noexcept;
}; // class decimal_fast64_t
} //namespace decimal
} //namespace boost