1 #ifndef POINCARE_IEEE754_H 2 #define POINCARE_IEEE754_H 22 return ((1 <<(k_exponentNbBits-1))-1);
25 return ((1<<k_exponentNbBits)-1);
28 assert(k_totalNumberOfBits == 8*
sizeof(
T));
29 return k_totalNumberOfBits;
37 u.ui |= ((
uint64_t)mantissa >> (
size()-k_mantissaNbBits-1) & oneOnMantissaBits);
41 if (((
uint64_t)mantissa >> (
size()-k_mantissaNbBits-2)) & 1) {
49 uint16_t oneOnExponentsBits = (1 << k_exponentNbBits)-1;
50 int exp = (u.ui >> k_mantissaNbBits) & oneOnExponentsBits;
55 static T k_log10base2 = 3.321928094887362347870319429489390175864831393024580612054;
81 constexpr
static size_t k_signNbBits = 1;
82 constexpr
static size_t k_exponentNbBits =
sizeof(
T) ==
sizeof(
float) ? 8 : 11;
83 constexpr
static size_t k_mantissaNbBits =
sizeof(
T) ==
sizeof(
float) ? 23 : 52;
84 constexpr
static size_t k_totalNumberOfBits = k_signNbBits+k_exponentNbBits+k_mantissaNbBits;
static uint16_t maxExponent()
static uint16_t exponentOffset()
static T buildFloat(bool sign, uint16_t exponent, uint64_t mantissa)
unsigned long long uint64_t
static int exponentBase10(T f)