fixed_point128 1.0.1.0
128 bit integer, fixed point and floating point arithmetic for C++20
Loading...
Searching...
No Matches
fp128::Float Struct Reference

Bit level view of an IEEE 754 single-precision value. More...

#include <fp128_shared.h>

Public Member Functions

constexpr Float (float v=0) noexcept
 Constructs from a float, or from positive zero when no value is given.
constexpr uint32_t f () const noexcept
 Mantissa (fraction) bits.
constexpr uint32_t e () const noexcept
 Biased exponent bits.
constexpr uint32_t s () const noexcept
 Sign bit (0 = positive, 1 = negative).
constexpr float val () const noexcept
 The float these bits encode.
constexpr void set_f (uint32_t v) noexcept
 Sets the mantissa. Bits above the field width are dropped, as a bit-field assignment would.
constexpr void set_e (uint32_t v) noexcept
 Sets the biased exponent. Bits above the field width are dropped.
constexpr void set_s (uint32_t v) noexcept
 Sets the sign bit.

Static Public Member Functions

static constexpr float make (uint32_t s, uint32_t e, uint32_t f) noexcept
 Assembles a float out of its three fields, see Double::make().

Public Attributes

uint32_t bits
 The raw bit pattern of the float.

Detailed Description

Bit level view of an IEEE 754 single-precision value.

The single precision counterpart of Double, see its documentation.

Definition at line 921 of file fp128_shared.h.

Constructor & Destructor Documentation

◆ Float()

fp128::Float::Float ( float v = 0)
inlineconstexprnoexcept

Constructs from a float, or from positive zero when no value is given.

Definition at line 925 of file fp128_shared.h.

Member Function Documentation

◆ f()

uint32_t fp128::Float::f ( ) const
inlinenodiscardconstexprnoexcept

Mantissa (fraction) bits.

Definition at line 928 of file fp128_shared.h.

◆ e()

uint32_t fp128::Float::e ( ) const
inlinenodiscardconstexprnoexcept

Biased exponent bits.

Definition at line 930 of file fp128_shared.h.

◆ s()

uint32_t fp128::Float::s ( ) const
inlinenodiscardconstexprnoexcept

Sign bit (0 = positive, 1 = negative).

Definition at line 932 of file fp128_shared.h.

◆ val()

float fp128::Float::val ( ) const
inlinenodiscardconstexprnoexcept

The float these bits encode.

Definition at line 934 of file fp128_shared.h.

◆ set_f()

void fp128::Float::set_f ( uint32_t v)
inlineconstexprnoexcept

Sets the mantissa. Bits above the field width are dropped, as a bit-field assignment would.

Definition at line 937 of file fp128_shared.h.

◆ set_e()

void fp128::Float::set_e ( uint32_t v)
inlineconstexprnoexcept

Sets the biased exponent. Bits above the field width are dropped.

Definition at line 939 of file fp128_shared.h.

◆ set_s()

void fp128::Float::set_s ( uint32_t v)
inlineconstexprnoexcept

Sets the sign bit.

Definition at line 941 of file fp128_shared.h.

◆ make()

constexpr float fp128::Float::make ( uint32_t s,
uint32_t e,
uint32_t f )
inlinestaticnodiscardconstexprnoexcept

Assembles a float out of its three fields, see Double::make().

Parameters
sSign bit.
eBiased exponent.
fMantissa.
Returns
The assembled float.

Definition at line 945 of file fp128_shared.h.

Member Data Documentation

◆ bits

uint32_t fp128::Float::bits

The raw bit pattern of the float.

Definition at line 922 of file fp128_shared.h.


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