PPL  1.2
Parma_Polyhedra_Library::float_ieee754_double Struct Reference

#include <Float_defs.hh>

Public Member Functions

int inf_sign () const
 
bool is_nan () const
 
int zero_sign () const
 
bool 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 = 0x80000000U
 
static const uint32_t MSP_POS_INF = 0x7ff00000U
 
static const uint32_t MSP_NEG_INF = 0xfff00000U
 
static const uint32_t MSP_POS_ZERO = 0x00000000U
 
static const uint32_t MSP_NEG_ZERO = 0x80000000U
 
static const uint32_t LSP_INF = 0
 
static const uint32_t LSP_ZERO = 0
 
static const uint32_t MSP_MAX = 0x7fefffffU
 
static const uint32_t LSP_MAX = 0xffffffffU
 
static const unsigned int BASE = 2
 
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
 
static const Floating_Point_Format floating_point_format = IEEE754_DOUBLE
 

Detailed Description

Definition at line 120 of file Float_defs.hh.

Member Function Documentation

void Parma_Polyhedra_Library::float_ieee754_double::build ( bool  negative,
mpz_t  mantissa,
int  exponent 
)
inline

Definition at line 244 of file Float_inlines.hh.

References EXPONENT_BIAS, EXPONENT_BITS, lsp, LSP_MAX, MANTISSA_BITS, msp, and MSP_SGN_MASK.

244  {
245  unsigned long m;
246 #if ULONG_MAX == 0xffffffffUL
247  lsp = mpz_get_ui(mantissa);
248  mpz_tdiv_q_2exp(mantissa, mantissa, 32);
249  m = mpz_get_ui(mantissa);
250 #else
251  m = mpz_get_ui(mantissa);
252  lsp = static_cast<uint32_t>(m & LSP_MAX);
253  m >>= 32;
254 #endif
255  msp = static_cast<uint32_t>(m & ((1UL << (MANTISSA_BITS - 32)) - 1));
256  if (negative) {
257  msp |= MSP_SGN_MASK;
258  }
259  const int exponent_repr = exponent + EXPONENT_BIAS;
260  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
261  msp |= static_cast<uint32_t>(exponent_repr) << (MANTISSA_BITS - 32);
262 }
void Parma_Polyhedra_Library::float_ieee754_double::dec ( )
inline

Definition at line 213 of file Float_inlines.hh.

References lsp, LSP_MAX, and msp.

213  {
214  if (lsp == 0) {
215  --msp;
216  lsp = LSP_MAX;
217  }
218  else {
219  --lsp;
220  }
221 }
void Parma_Polyhedra_Library::float_ieee754_double::inc ( )
inline

Definition at line 224 of file Float_inlines.hh.

References lsp, LSP_MAX, and msp.

224  {
225  if (lsp == LSP_MAX) {
226  ++msp;
227  lsp = 0;
228  }
229  else {
230  ++lsp;
231  }
232 }
int Parma_Polyhedra_Library::float_ieee754_double::inf_sign ( ) const
inline

Definition at line 169 of file Float_inlines.hh.

References lsp, LSP_INF, msp, MSP_NEG_INF, and MSP_POS_INF.

169  {
170  if (lsp != LSP_INF) {
171  return 0;
172  }
173  if (msp == MSP_NEG_INF) {
174  return -1;
175  }
176  if (msp == MSP_POS_INF) {
177  return 1;
178  }
179  return 0;
180 }
bool Parma_Polyhedra_Library::float_ieee754_double::is_nan ( ) const
inline

Definition at line 183 of file Float_inlines.hh.

References lsp, LSP_INF, msp, MSP_POS_INF, and MSP_SGN_MASK.

183  {
184  const uint32_t a = msp & ~MSP_SGN_MASK;
185  return a > MSP_POS_INF || (a == MSP_POS_INF && lsp != LSP_INF);
186 }
void Parma_Polyhedra_Library::float_ieee754_double::negate ( )
inline

Definition at line 203 of file Float_inlines.hh.

References msp, and MSP_SGN_MASK.

void Parma_Polyhedra_Library::float_ieee754_double::set_max ( bool  negative)
inline

Definition at line 235 of file Float_inlines.hh.

References lsp, LSP_MAX, msp, MSP_MAX, and MSP_SGN_MASK.

235  {
236  msp = MSP_MAX;
237  lsp = LSP_MAX;
238  if (negative) {
239  msp |= MSP_SGN_MASK;
240  }
241 }
bool Parma_Polyhedra_Library::float_ieee754_double::sign_bit ( ) const
inline

Definition at line 208 of file Float_inlines.hh.

References msp, and MSP_SGN_MASK.

208  {
209  return (msp & MSP_SGN_MASK) != 0;
210 }
int Parma_Polyhedra_Library::float_ieee754_double::zero_sign ( ) const
inline

Definition at line 189 of file Float_inlines.hh.

References lsp, LSP_ZERO, msp, MSP_NEG_ZERO, and MSP_POS_ZERO.

189  {
190  if (lsp != LSP_ZERO) {
191  return 0;
192  }
193  if (msp == MSP_NEG_ZERO) {
194  return -1;
195  }
196  if (msp == MSP_POS_ZERO) {
197  return 1;
198  }
199  return 0;
200 }

Member Data Documentation

const unsigned int Parma_Polyhedra_Library::float_ieee754_double::BASE = 2
static
const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_BIAS = EXPONENT_MAX
static

Definition at line 141 of file Float_defs.hh.

Referenced by build(), and Parma_Polyhedra_Library::compute_absolute_error().

const unsigned int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_BITS = 11
static

Definition at line 138 of file Float_defs.hh.

Referenced by build().

const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MAX = (1 << (EXPONENT_BITS - 1)) - 1
static

Definition at line 140 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MIN = -EXPONENT_MAX + 1
static

Definition at line 142 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ieee754_double::EXPONENT_MIN_DENORM
static
Initial value:
- static_cast<int>(MANTISSA_BITS)

Definition at line 143 of file Float_defs.hh.

const Floating_Point_Format Parma_Polyhedra_Library::float_ieee754_double::floating_point_format = IEEE754_DOUBLE
static

Definition at line 145 of file Float_defs.hh.

uint32_t Parma_Polyhedra_Library::float_ieee754_double::lsp

Definition at line 125 of file Float_defs.hh.

Referenced by build(), dec(), inc(), inf_sign(), is_nan(), set_max(), and zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_INF = 0
static

Definition at line 133 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_MAX = 0xffffffffU
static

Definition at line 136 of file Float_defs.hh.

Referenced by build(), dec(), inc(), and set_max().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_ZERO = 0
static

Definition at line 134 of file Float_defs.hh.

Referenced by zero_sign().

const unsigned int Parma_Polyhedra_Library::float_ieee754_double::MANTISSA_BITS = 52
static
uint32_t Parma_Polyhedra_Library::float_ieee754_double::msp

Definition at line 126 of file Float_defs.hh.

Referenced by build(), dec(), inc(), inf_sign(), is_nan(), negate(), set_max(), sign_bit(), and zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_MAX = 0x7fefffffU
static

Definition at line 135 of file Float_defs.hh.

Referenced by set_max().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_NEG_INF = 0xfff00000U
static

Definition at line 130 of file Float_defs.hh.

Referenced by inf_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_NEG_ZERO = 0x80000000U
static

Definition at line 132 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_POS_INF = 0x7ff00000U
static

Definition at line 129 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_POS_ZERO = 0x00000000U
static

Definition at line 131 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_SGN_MASK = 0x80000000U
static

Definition at line 128 of file Float_defs.hh.

Referenced by build(), is_nan(), negate(), set_max(), and sign_bit().


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