Parma_Polyhedra_Library::float_ieee754_double Struct Reference
[C++ Language Interface]

#include <Float.defs.hh>

List of all members.

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 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

Detailed Description

Definition at line 114 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 214 of file Float.inlines.hh.

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

00214                                                                        {
00215 #if ULONG_MAX == 0xffffffffUL
00216   lsp = mpz_get_ui(mantissa);
00217   mpz_tdiv_q_2exp(mantissa, mantissa, 32);
00218   unsigned long m = mpz_get_ui(mantissa);
00219 #else
00220   unsigned long m = mpz_get_ui(mantissa);
00221   lsp = m;
00222   m >>= 32;
00223 #endif
00224   msp = m & ((1UL << (MANTISSA_BITS - 32)) - 1);
00225   if (negative)
00226     msp |= MSP_SGN_MASK;
00227   msp |= static_cast<uint32_t>(exponent + EXPONENT_BIAS)
00228     << (MANTISSA_BITS - 32);
00229 }

void Parma_Polyhedra_Library::float_ieee754_double::dec (  )  [inline]

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

References lsp, LSP_MAX, and msp.

00186                           {
00187   if (lsp == 0) {
00188     --msp;
00189     lsp = LSP_MAX;
00190   }
00191   else
00192     --lsp;
00193 }

void Parma_Polyhedra_Library::float_ieee754_double::inc (  )  [inline]

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

References lsp, LSP_MAX, and msp.

00196                           {
00197   if (lsp == LSP_MAX) {
00198     ++msp;
00199     lsp = 0;
00200   }
00201   else
00202     ++lsp;
00203 }

int Parma_Polyhedra_Library::float_ieee754_double::is_inf (  )  const [inline]

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

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

00148                                    {
00149   if (lsp != LSP_INF)
00150     return 0;
00151   if (msp == MSP_NEG_INF)
00152     return -1;
00153   if (msp == MSP_POS_INF)
00154     return 1;
00155   return 0;
00156 }

int Parma_Polyhedra_Library::float_ieee754_double::is_nan (  )  const [inline]

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

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

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

int Parma_Polyhedra_Library::float_ieee754_double::is_zero (  )  const [inline]

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

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

00165                                     {
00166   if (lsp != LSP_ZERO)
00167     return 0;
00168   if (msp == MSP_NEG_ZERO)
00169     return -1;
00170   if (msp == MSP_POS_ZERO)
00171     return 1;
00172   return 0;
00173 }

void Parma_Polyhedra_Library::float_ieee754_double::negate (  )  [inline]

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

References msp, and MSP_SGN_MASK.

00176                              {
00177   msp ^= MSP_SGN_MASK;
00178 }

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

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

References lsp, msp, and MSP_SGN_MASK.

00206                                            {
00207   msp = 0x7fefffff;
00208   lsp = 0xffffffff;
00209   if (negative)
00210     msp |= MSP_SGN_MASK;
00211 }

int Parma_Polyhedra_Library::float_ieee754_double::sign_bit (  )  const [inline]

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

References msp, and MSP_SGN_MASK.

00181                                      {
00182   return !!(msp & MSP_SGN_MASK);
00183 }


Member Data Documentation

const unsigned int Parma_Polyhedra_Library::float_ieee754_double::BASE = 2 [static]

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

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

Referenced by build().

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

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

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

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

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

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

Referenced by build(), dec(), inc(), is_inf(), is_nan(), is_zero(), and set_max().

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

Referenced by is_inf(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::LSP_MAX = 0xffffffff [static]

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

Referenced by dec(), and inc().

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

Referenced by is_zero().

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

Referenced by build().

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

Referenced by build(), dec(), inc(), is_inf(), is_nan(), is_zero(), negate(), set_max(), and sign_bit().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_NEG_INF = 0xfff00000 [static]

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

Referenced by is_inf().

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

Referenced by is_zero().

const uint32_t Parma_Polyhedra_Library::float_ieee754_double::MSP_POS_INF = 0x7ff00000 [static]

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

Referenced by is_inf(), and is_nan().

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

Referenced by is_zero().

Definition at line 122 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:
Generated on Sun Feb 27 16:20:19 2011 for PPL by  doxygen 1.6.3