HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends
v1::decimal Class Reference

Public Member Functions

constexpr decimal (decimal const &other) noexcept=default
 
constexpr decimal (decimal &&other) noexcept=default
 
constexpr decimaloperator= (decimal const &other) noexcept=default
 
constexpr decimaloperator= (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 decimaloperator= (std::pair< int, long long > other) noexcept
 
decimaloperator= (std::string_view str) noexcept
 
constexpr decimaloperator= (double other) noexcept
 
constexpr decimaloperator= (float other) noexcept
 
constexpr decimaloperator= (signed long long other) noexcept
 
constexpr decimaloperator= (signed long other) noexcept
 
constexpr decimaloperator= (signed int other) noexcept
 
constexpr decimaloperator= (signed short other) noexcept
 
constexpr decimaloperator= (signed char other) noexcept
 
constexpr decimaloperator= (unsigned long long other) noexcept
 
constexpr decimaloperator= (unsigned long other) noexcept
 
constexpr decimaloperator= (unsigned int other) noexcept
 
constexpr decimaloperator= (unsigned short other) noexcept
 
constexpr decimaloperator= (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.
 
decimaloperator+= (decimal rhs) noexcept
 
decimaloperator-= (decimal rhs) noexcept
 
decimaloperator*= (decimal rhs) noexcept
 
decimaloperator/= (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()

constexpr int v1::decimal::exponent ( ) const
inlineconstexprnoexcept

Extract exponent from value.

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

◆ mantissa()

constexpr long long v1::decimal::mantissa ( ) const
inlineconstexprnoexcept

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()

constexpr decimal v1::decimal::normalize ( ) const
inlineconstexprnoexcept

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: