#include <Float.defs.hh>
Public Member Functions | |
int | is_inf () const |
int | is_nan () const |
int | is_zero () const |
int | sign_bit () const |
void | negate () |
void | dec () |
void | inc () |
void | set_max (bool negative) |
void | build (bool negative, mpz_t mantissa, int exponent) |
Public Attributes | |
uint32_t | lsp |
uint32_t | msp |
Static Public Attributes | |
static const uint32_t | MSP_SGN_MASK = 0x80000000 |
static const uint32_t | MSP_POS_INF = 0x7ff00000 |
static const uint32_t | MSP_NEG_INF = 0xfff00000 |
static const uint32_t | MSP_POS_ZERO = 0x00000000 |
static const uint32_t | MSP_NEG_ZERO = 0x80000000 |
static const uint32_t | LSP_INF = 0 |
static const uint32_t | LSP_ZERO = 0 |
static const uint32_t | LSP_MAX = 0xffffffff |
static const unsigned int | EXPONENT_BITS = 11 |
static const unsigned int | MANTISSA_BITS = 52 |
static const int | EXPONENT_MAX = (1 << (EXPONENT_BITS - 1)) - 1 |
static const int | EXPONENT_BIAS = EXPONENT_MAX |
static const int | EXPONENT_MIN = -EXPONENT_MAX + 1 |
static const int | EXPONENT_MIN_DENORM |
Definition at line 72 of file Float.defs.hh.
int Parma_Polyhedra_Library::float_ieee754_double::is_inf | ( | ) | const [inline] |
Definition at line 89 of file Float.inlines.hh.
References lsp, LSP_INF, msp, MSP_NEG_INF, and MSP_POS_INF.
00089 { 00090 if (lsp != LSP_INF) 00091 return 0; 00092 if (msp == MSP_NEG_INF) 00093 return -1; 00094 if (msp == MSP_POS_INF) 00095 return 1; 00096 return 0; 00097 }
int Parma_Polyhedra_Library::float_ieee754_double::is_nan | ( | ) | const [inline] |
Definition at line 100 of file Float.inlines.hh.
References lsp, LSP_INF, msp, MSP_POS_INF, and MSP_SGN_MASK.
00100 { 00101 uint32_t a = msp & ~MSP_SGN_MASK; 00102 return a > MSP_POS_INF || (a == MSP_POS_INF && lsp != LSP_INF); 00103 }
int Parma_Polyhedra_Library::float_ieee754_double::is_zero | ( | ) | const [inline] |
Definition at line 106 of file Float.inlines.hh.
References lsp, LSP_ZERO, msp, MSP_NEG_ZERO, and MSP_POS_ZERO.
00106 { 00107 if (lsp != LSP_ZERO) 00108 return 0; 00109 if (msp == MSP_NEG_ZERO) 00110 return -1; 00111 if (msp == MSP_POS_ZERO) 00112 return 1; 00113 return 0; 00114 }
int Parma_Polyhedra_Library::float_ieee754_double::sign_bit | ( | ) | const [inline] |
Definition at line 122 of file Float.inlines.hh.
References msp, and MSP_SGN_MASK.
00122 { 00123 return !!(msp & MSP_SGN_MASK); 00124 }
void Parma_Polyhedra_Library::float_ieee754_double::negate | ( | ) | [inline] |
Definition at line 117 of file Float.inlines.hh.
References msp, and MSP_SGN_MASK.
00117 { 00118 msp ^= MSP_SGN_MASK; 00119 }
void Parma_Polyhedra_Library::float_ieee754_double::dec | ( | ) | [inline] |
void Parma_Polyhedra_Library::float_ieee754_double::inc | ( | ) | [inline] |
void Parma_Polyhedra_Library::float_ieee754_double::set_max | ( | bool | negative | ) | [inline] |
Definition at line 147 of file Float.inlines.hh.
References lsp, msp, and MSP_SGN_MASK.
00147 { 00148 msp = 0x7fefffff; 00149 lsp = 0xffffffff; 00150 if (negative) 00151 msp |= MSP_SGN_MASK; 00152 }
void Parma_Polyhedra_Library::float_ieee754_double::build | ( | bool | negative, | |
mpz_t | mantissa, | |||
int | exponent | |||
) | [inline] |
Definition at line 155 of file Float.inlines.hh.
References EXPONENT_BIAS, lsp, MANTISSA_BITS, msp, and MSP_SGN_MASK.
00155 { 00156 #if ULONG_MAX == 0xffffffffUL 00157 lsp = mpz_get_ui(mantissa); 00158 mpz_tdiv_q_2exp(mantissa, mantissa, 32); 00159 unsigned long m = mpz_get_ui(mantissa); 00160 #else 00161 unsigned long m = mpz_get_ui(mantissa); 00162 lsp = m; 00163 m >>= 32; 00164 #endif 00165 msp = m & ((1UL << (MANTISSA_BITS - 32)) - 1); 00166 if (negative) 00167 msp |= MSP_SGN_MASK; 00168 msp |= static_cast<uint32_t>(exponent + EXPONENT_BIAS) 00169 << (MANTISSA_BITS - 32); 00170 }
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_SGN_MASK = 0x80000000 [static] |
Definition at line 80 of file Float.defs.hh.
Referenced by build(), is_nan(), negate(), set_max(), and sign_bit().
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_POS_INF = 0x7ff00000 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_NEG_INF = 0xfff00000 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_POS_ZERO = 0x00000000 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_NEG_ZERO = 0x80000000 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_INF = 0 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_ZERO = 0 [static] |
const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_MAX = 0xffffffff [static] |
const unsigned int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_BITS = 11 [static] |
Definition at line 88 of file Float.defs.hh.
const unsigned int Parma_Polyhedra_Library::float_ieee754_double::MANTISSA_BITS = 52 [static] |
const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MAX = (1 << (EXPONENT_BITS - 1)) - 1 [static] |
Definition at line 90 of file Float.defs.hh.
const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_BIAS = EXPONENT_MAX [static] |
const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MIN = -EXPONENT_MAX + 1 [static] |
Definition at line 92 of file Float.defs.hh.
const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MIN_DENORM [static] |
Initial value:
EXPONENT_MIN - static_cast<int>(MANTISSA_BITS)
Definition at line 93 of file Float.defs.hh.