Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Burger::uint64_double_t Union Reference

Union to create double values with integer constants. More...

Public Member Functions

 operator double () const noexcept
 Accessor to load the double precision floating point value.
 
uint64_double_toperator= (double dInput) noexcept
 Update with a new floating point value.
 
double get_double (void) const noexcept
 Accessor to load the 64 float.
 
void set_double (double dInput) noexcept
 Set the floating point value with a double.
 
uint64_t get_uint64 (void) const noexcept
 Accessor to load the 64 bit value in binary.
 
void set_uint64 (uint64_t uInput) noexcept
 Set the floating point value with a binary representation in an integer.
 
uint32_t get_low_uint32 (void) const noexcept
 Accessor to load the low 32 bits of the 64 bit word.
 
uint32_t get_high_uint32 (void) const noexcept
 Accessor to load the upper 32 bits of the 64 bit word.
 
void set_low_uint32 (uint32_t uInput) noexcept
 Accessor to load the low 32 bits of the 64 bit word.
 
void set_high_uint32 (uint32_t uInput) noexcept
 Accessor to load the low 32 bits of the 64 bit word.
 

Public Attributes

uint64_t w
 Value in binary.
 
double d
 Value as a 64 bit float.
 
uint32_t w32 [2]
 Array of 2 32 bit words that map on the 64 bit value.
 

Detailed Description

Union to create double values with integer constants.


Some "C" compilers are not 100% accurate in creating floating point constants. To get around this limitation, once the binary representation of a floating point number is determined, it will be used to assign the value so the binary representation does not change from compiler to compiler.

This union is also used to obtain the binary representation of a 64 bit float in a cross compiler way.

// Binary representation for Double Epsilon
Burger::uint64_double_t Epsilon = {0x3CB0000000000000ULL};
void code(void)
{
// Fetch as a float
double dEpsilon = Epsilon;
// Set a new floating point value
Epsilon = 1.5;
// Get the binary value as a 64 bit integer
uint64_t uEpsilon = Epsilon.get_uint64();
// Set the binary value as a 64 bit integer
Epsilon.set_uint64(0x3CB0000000000000ULL);
// Get the binary value as 32 bit integers
uint32_t uLowEpsilon = Epsilon.get_low_uint32();
uint32_t uHiEpsilon = Epsilon.get_high_uint32();
// Set the binary value as 32 bit integers
Epsilon.set_low_uint32(0x00000000U);
Epsilon.set_high_uint32(0x3CB00000U);
}
Select a type based if the conditional is true or false.
Definition burger.h:3178
Union to create double values with integer constants.
Definition burger.h:1793
See also
uint32_float_t

Member Function Documentation

◆ get_double()

Burger::uint64_double_t::get_double ( void ) const
inlinenoexcept

Accessor to load the 64 float.


Returns
Floating point value
See also
set_double(double), or get_uint64(void) const

◆ get_high_uint32()

Burger::uint64_double_t::get_high_uint32 ( void ) const
inlinenoexcept

Accessor to load the upper 32 bits of the 64 bit word.


Returns
Upper 32 bits of the 64 bit word
See also
get_low_uint32(void) const or set_high_uint32(uint32_t)

◆ get_low_uint32()

Burger::uint64_double_t::get_low_uint32 ( void ) const
inlinenoexcept

Accessor to load the low 32 bits of the 64 bit word.


Returns
Lower 32 bits of the 64 bit word
See also
get_high_uint32(void) const or set_low_uint32(uint32_t)

◆ get_uint64()

Burger::uint64_double_t::get_uint64 ( void ) const
inlinenoexcept

Accessor to load the 64 bit value in binary.


Returns
Floating point value as a binary representation in an integer
See also
set_uint64(uint64_t), set_low_uint32(uint32_t) or set_high_uint32(uint32_t)

◆ operator double()

Burger::uint64_double_t::operator double ( ) const
inlinenoexcept

Accessor to load the double precision floating point value.


See also
uint64_double_t::operator = (double)

◆ operator=()

Burger::uint64_double_t::operator= ( double dInput)
inlinenoexcept

Update with a new floating point value.


Parameters
dInput64 bit floating point number to store in the union
See also
uint64_double_t::operator double() const

◆ set_double()

Burger::uint64_double_t::set_double ( double dInput)
inlinenoexcept

Set the floating point value with a double.


Parameters
dInput64 bit float to store in the union
See also
get_double(void) const, or set_uint64(uint64_t)

◆ set_high_uint32()

Burger::uint64_double_t::set_high_uint32 ( uint32_t uInput)
inlinenoexcept

Accessor to load the low 32 bits of the 64 bit word.


Parameters
uInput32 bit integer to store in the upper 32 bits of the double
See also
set_low_uint32(uint32_t) or get_high_uint32(void) const

◆ set_low_uint32()

Burger::uint64_double_t::set_low_uint32 ( uint32_t uInput)
inlinenoexcept

Accessor to load the low 32 bits of the 64 bit word.


Parameters
uInput32 bit integer to store in the low 32 bits of the double
See also
set_high_uint32(uint32_t) or get_low_uint32(void) const

◆ set_uint64()

Burger::uint64_double_t::set_uint64 ( uint64_t uInput)
inlinenoexcept

Set the floating point value with a binary representation in an integer.


Parameters
uInput64 bit integer to store in the union
See also
get_uint64(void) const, get_low_uint32(void) const or get_high_uint32(void) const

Member Data Documentation

◆ d

double Burger::uint64_double_t::d

Value as a 64 bit float.

◆ w

uint64_t Burger::uint64_double_t::w

Value in binary.

◆ w32

uint32_t Burger::uint64_double_t::w32[2]

Array of 2 32 bit words that map on the 64 bit value.