PPL  1.2
Parma_Polyhedra_Library::float_ibm_single 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 word
 

Static Public Attributes

static const uint32_t SGN_MASK = 0x80000000U
 
static const uint32_t EXP_MASK = 0x7f000000U
 
static const uint32_t WRD_MAX = 0x7fffffffU
 
static const uint32_t POS_INF = 0x7f000000U
 
static const uint32_t NEG_INF = 0xff000000U
 
static const uint32_t POS_ZERO = 0x00000000U
 
static const uint32_t NEG_ZERO = 0x80000000U
 
static const unsigned int BASE = 16
 
static const unsigned int EXPONENT_BITS = 7
 
static const unsigned int MANTISSA_BITS = 24
 
static const int EXPONENT_BIAS = 64
 
static const int EXPONENT_MAX = (1 << (EXPONENT_BITS - 1)) - 1
 
static const int EXPONENT_MIN = -EXPONENT_MAX + 1
 
static const int EXPONENT_MIN_DENORM
 
static const Floating_Point_Format floating_point_format = IBM_SINGLE
 

Detailed Description

Definition at line 160 of file Float_defs.hh.

Member Function Documentation

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

Definition at line 320 of file Float_inlines.hh.

References EXPONENT_BIAS, EXPONENT_BITS, MANTISSA_BITS, SGN_MASK, and word.

320  {
321  word = static_cast<uint32_t>(mpz_get_ui(mantissa)
322  & ((1UL << MANTISSA_BITS) - 1));
323  if (negative) {
324  word |= SGN_MASK;
325  }
326  const int exponent_repr = exponent + EXPONENT_BIAS;
327  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
328  word |= static_cast<uint32_t>(exponent_repr) << MANTISSA_BITS;
329 }
static const unsigned int MANTISSA_BITS
Definition: Float_defs.hh:171
static const unsigned int EXPONENT_BITS
Definition: Float_defs.hh:170
void Parma_Polyhedra_Library::float_ibm_single::dec ( )
inline

Definition at line 302 of file Float_inlines.hh.

References word.

302  {
303  --word;
304 }
void Parma_Polyhedra_Library::float_ibm_single::inc ( )
inline

Definition at line 307 of file Float_inlines.hh.

References word.

307  {
308  ++word;
309 }
int Parma_Polyhedra_Library::float_ibm_single::inf_sign ( ) const
inline

Definition at line 265 of file Float_inlines.hh.

References NEG_INF, POS_INF, and word.

265  {
266  if (word == NEG_INF) {
267  return -1;
268  }
269  if (word == POS_INF) {
270  return 1;
271  }
272  return 0;
273 }
bool Parma_Polyhedra_Library::float_ibm_single::is_nan ( ) const
inline

Definition at line 276 of file Float_inlines.hh.

References POS_INF, SGN_MASK, and word.

276  {
277  return (word & ~SGN_MASK) > POS_INF;
278 }
void Parma_Polyhedra_Library::float_ibm_single::negate ( )
inline

Definition at line 292 of file Float_inlines.hh.

References SGN_MASK, and word.

292  {
293  word ^= SGN_MASK;
294 }
void Parma_Polyhedra_Library::float_ibm_single::set_max ( bool  negative)
inline

Definition at line 312 of file Float_inlines.hh.

References SGN_MASK, word, and WRD_MAX.

312  {
313  word = WRD_MAX;
314  if (negative) {
315  word |= SGN_MASK;
316  }
317 }
bool Parma_Polyhedra_Library::float_ibm_single::sign_bit ( ) const
inline

Definition at line 297 of file Float_inlines.hh.

References SGN_MASK, and word.

297  {
298  return (word & SGN_MASK) != 0;
299 }
int Parma_Polyhedra_Library::float_ibm_single::zero_sign ( ) const
inline

Definition at line 281 of file Float_inlines.hh.

References NEG_ZERO, POS_ZERO, and word.

281  {
282  if (word == NEG_ZERO) {
283  return -1;
284  }
285  if (word == POS_ZERO) {
286  return 1;
287  }
288  return 0;
289 }

Member Data Documentation

const unsigned int Parma_Polyhedra_Library::float_ibm_single::BASE = 16
static
const uint32_t Parma_Polyhedra_Library::float_ibm_single::EXP_MASK = 0x7f000000U
static

Definition at line 163 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ibm_single::EXPONENT_BIAS = 64
static

Definition at line 172 of file Float_defs.hh.

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

const unsigned int Parma_Polyhedra_Library::float_ibm_single::EXPONENT_BITS = 7
static

Definition at line 170 of file Float_defs.hh.

Referenced by build().

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

Definition at line 173 of file Float_defs.hh.

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

Definition at line 174 of file Float_defs.hh.

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

Definition at line 175 of file Float_defs.hh.

const Floating_Point_Format Parma_Polyhedra_Library::float_ibm_single::floating_point_format = IBM_SINGLE
static

Definition at line 177 of file Float_defs.hh.

const unsigned int Parma_Polyhedra_Library::float_ibm_single::MANTISSA_BITS = 24
static
const uint32_t Parma_Polyhedra_Library::float_ibm_single::NEG_INF = 0xff000000U
static

Definition at line 166 of file Float_defs.hh.

Referenced by inf_sign().

const uint32_t Parma_Polyhedra_Library::float_ibm_single::NEG_ZERO = 0x80000000U
static

Definition at line 168 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ibm_single::POS_INF = 0x7f000000U
static

Definition at line 165 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ibm_single::POS_ZERO = 0x00000000U
static

Definition at line 167 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ibm_single::SGN_MASK = 0x80000000U
static

Definition at line 162 of file Float_defs.hh.

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

uint32_t Parma_Polyhedra_Library::float_ibm_single::word

Definition at line 161 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_ibm_single::WRD_MAX = 0x7fffffffU
static

Definition at line 164 of file Float_defs.hh.

Referenced by set_max().


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