HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
v1::decimal Class Reference

Public Member Functions

constexpr decimal (decimal const &other) noexcept=default
constexpr decimal (decimal &&other) noexcept=default
constexpr decimal & operator= (decimal const &other) noexcept=default
constexpr decimal & operator= (decimal &&other) noexcept=default
constexpr decimal (int exponent, long long mantissa) noexcept
constexpr decimal (std::pair< int, long long > exponent_mantissa)
 decimal (std::string_view str)
 decimal (double x) noexcept
 decimal (float x) noexcept
constexpr decimal (signed long long x)
constexpr decimal (signed long x)
constexpr decimal (signed int x)
constexpr decimal (signed short x)
constexpr decimal (signed char x)
constexpr decimal (unsigned long long x)
constexpr decimal (unsigned long x)
constexpr decimal (unsigned int x)
constexpr decimal (unsigned short x)
constexpr decimal (unsigned char x)
constexpr decimal & operator= (std::pair< int, long long > other) noexcept
decimal & operator= (std::string_view str) noexcept
constexpr decimal & operator= (double other) noexcept
constexpr decimal & operator= (float other) noexcept
constexpr decimal & operator= (signed long long other) noexcept
constexpr decimal & operator= (signed long other) noexcept
constexpr decimal & operator= (signed int other) noexcept
constexpr decimal & operator= (signed short other) noexcept
constexpr decimal & operator= (signed char other) noexcept
constexpr decimal & operator= (unsigned long long other) noexcept
constexpr decimal & operator= (unsigned long other) noexcept
constexpr decimal & operator= (unsigned int other) noexcept
constexpr decimal & operator= (unsigned short other) noexcept
constexpr decimal & operator= (unsigned char other) noexcept
 operator signed long long () const noexcept
 operator signed long () const noexcept
 operator signed int () const noexcept
 operator signed short () const noexcept
 operator signed char () const noexcept
 operator unsigned long long () const noexcept
 operator unsigned long () const noexcept
 operator unsigned int () const noexcept
 operator unsigned short () const noexcept
 operator unsigned char () const noexcept
 operator long double () const noexcept
 operator double () const noexcept
 operator float () const noexcept
 operator bool () const noexcept
std::size_t hash () const noexcept
constexpr int exponent () const noexcept
 Extract exponent from value.
constexpr long long mantissa () const noexcept
 Extract mantissa from value.
constexpr std::pair< int, long long > exponent_mantissa () const noexcept
constexpr decimal normalize () const noexcept
 Return a normalized decimal.
decimal & operator+= (decimal rhs) noexcept
decimal & operator-= (decimal rhs) noexcept
decimal & operator*= (decimal rhs) noexcept
decimal & operator/= (decimal rhs) noexcept

Static Public Attributes

static constexpr int mantissa_bits = 56
static constexpr int exponent_bits = 8
static constexpr int exponent_max = 127
static constexpr int exponent_min = -128

Friends

bool operator== (decimal lhs, decimal rhs) noexcept
auto operator<=> (decimal lhs, decimal rhs) noexcept
constexpr decimal operator- (decimal rhs) noexcept
decimal operator+ (decimal lhs, decimal rhs) noexcept
decimal operator- (decimal lhs, decimal rhs) noexcept
decimal operator* (decimal lhs, decimal rhs) noexcept
decimal operator/ (decimal lhs, decimal rhs) noexcept
decimal operator% (decimal lhs, decimal rhs) noexcept
std::string to_string (decimal x) noexcept
std::ostreamoperator<< (std::ostream &lhs, decimal rhs)

Member Function Documentation

◆ exponent()

int v1::decimal::exponent ( ) const
inlinenodiscardconstexprnoexcept

Extract exponent from value.

The exponent is encoded in the least significant bits so that only a MOVSX instruction is needed.

◆ mantissa()

long long v1::decimal::mantissa ( ) const
inlinenodiscardconstexprnoexcept

Extract mantissa from value.

The mantissa is encoded in the most significant bits so that only a single SAR instruction with a small shift value is needed.

◆ normalize()

decimal v1::decimal::normalize ( ) const
inlinenodiscardconstexprnoexcept

Return a normalized decimal.

The returned decimal will not have trailing zeros.

Returns
A normalized decimal.

The documentation for this class was generated from the following file: