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

uint64_t lsp
 
uint64_t msp
 

Static Public Attributes

static const uint64_t MSP_SGN_MASK = static_cast<uint64_t>(0x8000000000000000ULL)
 
static const uint64_t MSP_POS_INF = static_cast<uint64_t>(0x7fff000000000000ULL)
 
static const uint64_t MSP_NEG_INF = static_cast<uint64_t>(0xffff000000000000ULL)
 
static const uint64_t MSP_POS_ZERO = static_cast<uint64_t>(0x0000000000000000ULL)
 
static const uint64_t MSP_NEG_ZERO = static_cast<uint64_t>(0x8000000000000000ULL)
 
static const uint64_t LSP_INF = 0
 
static const uint64_t LSP_ZERO = 0
 
static const uint64_t MSP_MAX = static_cast<uint64_t>(0x7ffeffffffffffffULL)
 
static const uint64_t LSP_MAX = static_cast<uint64_t>(0xffffffffffffffffULL)
 
static const unsigned int BASE = 2
 
static const unsigned int EXPONENT_BITS = 15
 
static const unsigned int MANTISSA_BITS = 112
 
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_QUAD
 

Detailed Description

Definition at line 244 of file Float_defs.hh.

Member Function Documentation

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

Definition at line 498 of file Float_inlines.hh.

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

498  {
499  uint64_t parts[2];
500  mpz_export(parts, 0, -1, sizeof(parts[0]), 0, 0, mantissa);
501  lsp = parts[0];
502  msp = parts[1];
503  msp &= ((static_cast<uint64_t>(1) << (MANTISSA_BITS - 64)) - 1);
504  if (negative) {
505  msp |= MSP_SGN_MASK;
506  }
507  const int exponent_repr = exponent + EXPONENT_BIAS;
508  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
509  msp |= static_cast<uint64_t>(exponent_repr) << (MANTISSA_BITS - 64);
510 }
static const unsigned int MANTISSA_BITS
Definition: Float_defs.hh:263
static const unsigned int EXPONENT_BITS
Definition: Float_defs.hh:262
void Parma_Polyhedra_Library::float_ieee754_quad::dec ( )
inline

Definition at line 467 of file Float_inlines.hh.

References lsp, LSP_MAX, and msp.

467  {
468  if (lsp == 0) {
469  --msp;
470  lsp = LSP_MAX;
471  }
472  else {
473  --lsp;
474  }
475 }
void Parma_Polyhedra_Library::float_ieee754_quad::inc ( )
inline

Definition at line 478 of file Float_inlines.hh.

References lsp, LSP_MAX, and msp.

478  {
479  if (lsp == LSP_MAX) {
480  ++msp;
481  lsp = 0;
482  }
483  else {
484  ++lsp;
485  }
486 }
int Parma_Polyhedra_Library::float_ieee754_quad::inf_sign ( ) const
inline

Definition at line 423 of file Float_inlines.hh.

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

423  {
424  if (lsp != LSP_INF) {
425  return 0;
426  }
427  if (msp == MSP_NEG_INF) {
428  return -1;
429  }
430  if (msp == MSP_POS_INF) {
431  return 1;
432  }
433  return 0;
434 }
bool Parma_Polyhedra_Library::float_ieee754_quad::is_nan ( ) const
inline

Definition at line 437 of file Float_inlines.hh.

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

void Parma_Polyhedra_Library::float_ieee754_quad::negate ( )
inline

Definition at line 457 of file Float_inlines.hh.

References msp, and MSP_SGN_MASK.

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

Definition at line 489 of file Float_inlines.hh.

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

489  {
490  msp = MSP_MAX;
491  lsp = LSP_MAX;
492  if (negative) {
493  msp |= MSP_SGN_MASK;
494  }
495 }
bool Parma_Polyhedra_Library::float_ieee754_quad::sign_bit ( ) const
inline

Definition at line 462 of file Float_inlines.hh.

References msp, and MSP_SGN_MASK.

462  {
463  return (msp & MSP_SGN_MASK) != 0;
464 }
int Parma_Polyhedra_Library::float_ieee754_quad::zero_sign ( ) const
inline

Definition at line 443 of file Float_inlines.hh.

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

443  {
444  if (lsp != LSP_ZERO) {
445  return 0;
446  }
447  if (msp == MSP_NEG_ZERO) {
448  return -1;
449  }
450  if (msp == MSP_POS_ZERO) {
451  return 1;
452  }
453  return 0;
454 }

Member Data Documentation

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

Definition at line 265 of file Float_defs.hh.

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

const unsigned int Parma_Polyhedra_Library::float_ieee754_quad::EXPONENT_BITS = 15
static

Definition at line 262 of file Float_defs.hh.

Referenced by build().

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

Definition at line 264 of file Float_defs.hh.

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

Definition at line 266 of file Float_defs.hh.

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

Definition at line 267 of file Float_defs.hh.

const Floating_Point_Format Parma_Polyhedra_Library::float_ieee754_quad::floating_point_format = IEEE754_QUAD
static

Definition at line 269 of file Float_defs.hh.

uint64_t Parma_Polyhedra_Library::float_ieee754_quad::lsp

Definition at line 249 of file Float_defs.hh.

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

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::LSP_INF = 0
static

Definition at line 257 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::LSP_MAX = static_cast<uint64_t>(0xffffffffffffffffULL)
static

Definition at line 260 of file Float_defs.hh.

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

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::LSP_ZERO = 0
static

Definition at line 258 of file Float_defs.hh.

Referenced by zero_sign().

const unsigned int Parma_Polyhedra_Library::float_ieee754_quad::MANTISSA_BITS = 112
static
uint64_t Parma_Polyhedra_Library::float_ieee754_quad::msp

Definition at line 250 of file Float_defs.hh.

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

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_MAX = static_cast<uint64_t>(0x7ffeffffffffffffULL)
static

Definition at line 259 of file Float_defs.hh.

Referenced by set_max().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_NEG_INF = static_cast<uint64_t>(0xffff000000000000ULL)
static

Definition at line 254 of file Float_defs.hh.

Referenced by inf_sign().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_NEG_ZERO = static_cast<uint64_t>(0x8000000000000000ULL)
static

Definition at line 256 of file Float_defs.hh.

Referenced by zero_sign().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_POS_INF = static_cast<uint64_t>(0x7fff000000000000ULL)
static

Definition at line 253 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_POS_ZERO = static_cast<uint64_t>(0x0000000000000000ULL)
static

Definition at line 255 of file Float_defs.hh.

Referenced by zero_sign().

const uint64_t Parma_Polyhedra_Library::float_ieee754_quad::MSP_SGN_MASK = static_cast<uint64_t>(0x8000000000000000ULL)
static

Definition at line 252 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: