28 static const UINT32 k_uOne = 0x3f800000;
29 static const UINT32 k_uTwo = 0x40000000;
31 static const UINT32 k_SIGN_MASK = 0x80000000;
33 static const UINT32 k_EXP_MASK = 0x7f800000;
35 static const UINT32 k_MANT_MASK = 0x007fffff;
36 static const UINT32 k_MANT_BITS = 23;
59 ::memcpy(&dst, &
src,
sizeof(dst));
68 ::memcpy(&dst, &
src,
sizeof(dst));
76 return (m_v.
u_dw & k_MANT_MASK);
91 static const UINT64 k_SIGN_MASK =
CUINT64(80000000, 00000000);
93 static const UINT64 k_EXP_MASK =
CUINT64(7FF00000, 00000000);
95 static const UINT64 k_MANT_MASK =
CUINT64(000FFFFF, FFFFFFFF);
96 static const UINT32 k_MANT_BITS = 52;
119 ::memcpy(&dst, &
src,
sizeof(dst));
128 ::memcpy(&dst, &
src,
sizeof(dst));
134 short get_Exponent() const noexcept
137 return (
short)((m_v.
u_qw & k_EXP_MASK) >> sdf);
142 return (m_v.
u_qw & k_MANT_MASK);
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define CUINT64(h, l)
Definition: cBits.h:39
#define STATIC_ASSERT(exp, name)
Definition: cDebugAssert.h:24
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
cUnion32 m_v
holds the float32.
Definition: cFloat.h:26
cFloat32() noexcept
Definition: cFloat.h:39
void put_Bits(UINT32 dw) noexcept
Definition: cFloat.h:48
UINT32 get_Mantissa() const noexcept
Definition: cFloat.h:74
cFloat32(float f) noexcept
Definition: cFloat.h:43
static float fromBits(UINT32 src) noexcept
Definition: cFloat.h:62
static UINT32 toBits(float src) noexcept
Definition: cFloat.h:53
static UINT64 toBits(double src) noexcept
Definition: cFloat.h:113
cUnion64 m_v
holds the float64.
Definition: cFloat.h:89
cFloat64(double d) noexcept
Definition: cFloat.h:103
UINT64 get_Mantissa() const noexcept
Definition: cFloat.h:140
static double fromBits(UINT64 src) noexcept
Definition: cFloat.h:122
cFloat64() noexcept
Definition: cFloat.h:99
void put_Bits(UINT64 qw) noexcept
Definition: cFloat.h:108
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
Definition: cDebugAssert.h:29
float u_f
32 bit float.
Definition: cTypes.h:79
UINT32 u_dw
32 bit unsigned
Definition: cTypes.h:78
double u_d
assumed to be 64 bits.
Definition: cTypes.h:119
UINT64 u_qw
64 bits = QuadPart = ULONGLONG.
Definition: cTypes.h:122