PPL  0.12.1
Parma_Polyhedra_Library::float_ieee754_double Struct Reference

#include <Float.defs.hh>

List of all members.

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 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 119 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 222 of file Float.inlines.hh.

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

                                                                       {
  unsigned long m;
#if ULONG_MAX == 0xffffffffUL
  lsp = mpz_get_ui(mantissa);
  mpz_tdiv_q_2exp(mantissa, mantissa, 32);
  m = mpz_get_ui(mantissa);
#else
  m = mpz_get_ui(mantissa);
  lsp = static_cast<uint32_t>(m & LSP_MAX);
  m >>= 32;
#endif
  msp = static_cast<uint32_t>(m & ((1UL << (MANTISSA_BITS - 32)) - 1));
  if (negative)
    msp |= MSP_SGN_MASK;
  int exponent_repr = exponent + EXPONENT_BIAS;
  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
  msp |= static_cast<uint32_t>(exponent_repr) << (MANTISSA_BITS - 32);
}

Definition at line 194 of file Float.inlines.hh.

References lsp, LSP_MAX, and msp.

                          {
  if (lsp == 0) {
    --msp;
    lsp = LSP_MAX;
  }
  else
    --lsp;
}

Definition at line 204 of file Float.inlines.hh.

References lsp, LSP_MAX, and msp.

                          {
  if (lsp == LSP_MAX) {
    ++msp;
    lsp = 0;
  }
  else
    ++lsp;
}

Definition at line 156 of file Float.inlines.hh.

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

                                     {
  if (lsp != LSP_INF)
    return 0;
  if (msp == MSP_NEG_INF)
    return -1;
  if (msp == MSP_POS_INF)
    return 1;
  return 0;
}

Definition at line 167 of file Float.inlines.hh.

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

                                   {
  uint32_t a = msp & ~MSP_SGN_MASK;
  return a > MSP_POS_INF || (a == MSP_POS_INF && lsp != LSP_INF);
}

Definition at line 184 of file Float.inlines.hh.

References msp, and MSP_SGN_MASK.

                             {
  msp ^= MSP_SGN_MASK;
}

Definition at line 214 of file Float.inlines.hh.

References lsp, msp, and MSP_SGN_MASK.

                                           {
  msp = 0x7fefffffU;
  lsp = 0xffffffffU;
  if (negative)
    msp |= MSP_SGN_MASK;
}

Definition at line 189 of file Float.inlines.hh.

References msp, and MSP_SGN_MASK.

                                     {
  return (msp & MSP_SGN_MASK) != 0;
}

Definition at line 173 of file Float.inlines.hh.

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

                                      {
  if (lsp != LSP_ZERO)
    return 0;
  if (msp == MSP_NEG_ZERO)
    return -1;
  if (msp == MSP_POS_ZERO)
    return 1;
  return 0;
}

Member Data Documentation

Definition at line 136 of file Float.defs.hh.

Referenced by build().

Definition at line 138 of file Float.defs.hh.

Initial value:
 EXPONENT_MIN
                                        - static_cast<int>(MANTISSA_BITS)

Definition at line 141 of file Float.defs.hh.

Definition at line 132 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 134 of file Float.defs.hh.

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

Definition at line 133 of file Float.defs.hh.

Referenced by zero_sign().

Definition at line 129 of file Float.defs.hh.

Referenced by inf_sign().

Definition at line 131 of file Float.defs.hh.

Referenced by zero_sign().

Definition at line 128 of file Float.defs.hh.

Referenced by inf_sign(), and is_nan().

Definition at line 130 of file Float.defs.hh.

Referenced by zero_sign().

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