xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::numeric::IeeeFloatingPointTraits< Type > Struct Template Referencefinal

Information about an IEEE floating point type. More...

#include <numeric/IeeeFloatingPointTraits.hpp>

Classes

struct  Bits
 A type that can store all the bits of the type. More...
 

Static Public Member Functions

static consteval auto signBitMask () -> Bits
 Gets a bit mask for the sign bit.
 
static consteval auto exponentBitMask () -> Bits
 Gets a bit mask for all of the used bits.
 
static consteval auto mantissaBitMask () -> Bits
 Gets a bit mask for the sign bit.
 
static consteval auto integerBitMask () -> Bits
 Gets a bit mask for the extra integer bit of x86 80-bit extended precision format.
 
static consteval auto relevantBitMask () -> Bits
 Gets a bit mask for all of the relevant bits.
 
static consteval auto zeroBits () -> Bits
 Gets the bits for the value 0.
 
static consteval auto infinityBits () -> Bits
 Gets the bits for infinity.
 
static consteval auto signalingNanBits () -> Bits
 Gets the bits for a signalling NaN.
 
static consteval auto quietNanBits () -> Bits
 Gets the bits for a quiet NaN.
 
static constexpr auto bits (const Type &value) -> Bits
 Gets the bits for a certain value.
 
static constexpr auto fromBits (const Bits &bits) -> Type
 Gets the value represented by certain bits.
 

Static Public Attributes

static constexpr bool kIsIeeeFloatingPoint
 Indicates that this is a IEEE floating point type.
 
static constexpr int kSignBits
 The number of sign bits.
 
static constexpr int kExponentBits
 The number of exponent bits.
 
static constexpr int kMantissaBits
 The number of mantissa bits.
 
static constexpr int kRelevantBits
 The total number of relevant bits.
 
static constexpr bool kHasPadding
 Whether there are padding bits.
 

Detailed Description

template<typename Type>
struct xentara::utils::numeric::IeeeFloatingPointTraits< Type >

Information about an IEEE floating point type.

This is a specialization of IeeeFloatingPointTraits for actual IEEE floating point types.

Member Function Documentation

◆ bits()

template<typename Type >
static constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::bits ( const Type &  value) -> Bits
staticconstexpr

Gets the bits for a certain value.

This function is only available for IEEE floating point types

Parameters
valueThe value.
Returns
The bits for the value. Any padding bits are set to 0.

◆ exponentBitMask()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::exponentBitMask ( ) -> Bits
static

Gets a bit mask for all of the used bits.

This function is only available for IEEE floating point types

◆ fromBits()

template<typename Type >
static constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::fromBits ( const Bits bits) -> Type
staticconstexpr

Gets the value represented by certain bits.

This function is only available for IEEE floating point types

Parameters
bitsThe bits.
Returns
The value represented by the bits.

◆ infinityBits()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::infinityBits ( ) -> Bits
static

Gets the bits for infinity.

This function is only available for IEEE floating point types

Returns
The bits for infinity. Any padding bits are set to 0.

◆ integerBitMask()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::integerBitMask ( ) -> Bits
static

Gets a bit mask for the extra integer bit of x86 80-bit extended precision format.

Contary to single, double, and quad precision floating points, x86 80-bit floats do not have an implicit leading 1 bit in the mantissa, but store this bit explicitly. This is called the integer bit, because it represents the integer part of the mantissa.

This function is only available for IEEE floating point types

Returns
A mask for the integer bit, or an empty mask if the type is not an x86 80-bit extended precision float.

◆ mantissaBitMask()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::mantissaBitMask ( ) -> Bits
static

Gets a bit mask for the sign bit.

This function is only available for IEEE floating point types

◆ quietNanBits()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::quietNanBits ( ) -> Bits
static

Gets the bits for a quiet NaN.

This function is only available for IEEE floating point types

Returns
The bits for a quiet NaN. Any padding bits are set to 0.

◆ relevantBitMask()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::relevantBitMask ( ) -> Bits
static

Gets a bit mask for all of the relevant bits.

This function is only available for IEEE floating point types

◆ signalingNanBits()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::signalingNanBits ( ) -> Bits
static

Gets the bits for a signalling NaN.

This function is only available for IEEE floating point types

Returns
The bits for a signalling NaN. Any padding bits are set to 0.

◆ signBitMask()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::signBitMask ( ) -> Bits
static

Gets a bit mask for the sign bit.

This function is only available for IEEE floating point types

◆ zeroBits()

template<typename Type >
static consteval auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::zeroBits ( ) -> Bits
static

Gets the bits for the value 0.

This function is only available for IEEE floating point types

Returns
The bits the value 0. Any padding bits are set to 0.

Member Data Documentation

◆ kExponentBits

template<typename Type >
constexpr int xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kExponentBits
staticconstexpr

The number of exponent bits.

For types that are not IEEE floating point types, this value is 0.

◆ kHasPadding

template<typename Type >
constexpr bool xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kHasPadding
staticconstexpr

Whether there are padding bits.

For types that are not IEEE floating point types, this value is false.

◆ kIsIeeeFloatingPoint

template<typename Type >
constexpr bool xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kIsIeeeFloatingPoint
staticconstexpr

Indicates that this is a IEEE floating point type.

◆ kMantissaBits

template<typename Type >
constexpr int xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kMantissaBits
staticconstexpr

The number of mantissa bits.

For types that are not IEEE floating point types, this value is 0.

◆ kRelevantBits

template<typename Type >
constexpr int xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kRelevantBits
staticconstexpr

The total number of relevant bits.

For types that are not IEEE floating point types, this value is 0.

◆ kSignBits

template<typename Type >
constexpr int xentara::utils::numeric::IeeeFloatingPointTraits< Type >::kSignBits
staticconstexpr

The number of sign bits.

This value is 1 for all IEEE floating point types.

For types that are not IEEE floating point types, this value is 0.