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 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 77 of file Float.defs.hh.


Member Function Documentation

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

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

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

00095                                    {
00096   if (lsp != LSP_INF)
00097     return 0;
00098   if (msp == MSP_NEG_INF)
00099     return -1;
00100   if (msp == MSP_POS_INF)
00101     return 1;
00102   return 0;
00103 }

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

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

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

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

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

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

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

00112                                     {
00113   if (lsp != LSP_ZERO)
00114     return 0;
00115   if (msp == MSP_NEG_ZERO)
00116     return -1;
00117   if (msp == MSP_POS_ZERO)
00118     return 1;
00119   return 0;
00120 }

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

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

References msp, and MSP_SGN_MASK.

00128                                      {
00129   return !!(msp & MSP_SGN_MASK);
00130 }

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

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

References msp, and MSP_SGN_MASK.

00123                              {
00124   msp ^= MSP_SGN_MASK;
00125 }

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

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

References lsp, LSP_MAX, and msp.

00133                           {
00134   if (lsp == 0) {
00135     msp--;
00136     lsp = LSP_MAX;
00137   }
00138   else
00139     lsp--;
00140 }

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

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

References lsp, LSP_MAX, and msp.

00143                           {
00144   if (lsp == LSP_MAX) {
00145     msp++;
00146     lsp = 0;
00147   }
00148   else
00149     lsp++;
00150 }

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

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

References lsp, msp, and MSP_SGN_MASK.

00153                                            {
00154   msp = 0x7fefffff;
00155   lsp = 0xffffffff;
00156   if (negative)
00157     msp |= MSP_SGN_MASK;
00158 }

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

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

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

00161                                                                        {
00162 #if ULONG_MAX == 0xffffffffUL
00163   lsp = mpz_get_ui(mantissa);
00164   mpz_tdiv_q_2exp(mantissa, mantissa, 32);
00165   unsigned long m = mpz_get_ui(mantissa);
00166 #else
00167   unsigned long m = mpz_get_ui(mantissa);
00168   lsp = m;
00169   m >>= 32;
00170 #endif
00171   msp = m & ((1UL << (MANTISSA_BITS - 32)) - 1);
00172   if (negative)
00173     msp |= MSP_SGN_MASK;
00174   msp |= static_cast<uint32_t>(exponent + EXPONENT_BIAS)
00175     << (MANTISSA_BITS - 32);
00176 }


Member Data Documentation

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

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

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

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

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

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

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

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

Referenced by is_inf(), and is_nan().

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

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

Referenced by is_inf().

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

Referenced by is_zero().

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

Referenced by is_zero().

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

Referenced by is_inf(), and is_nan().

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

Referenced by is_zero().

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

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

Referenced by dec(), and inc().

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

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

Referenced by build().

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

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

Referenced by build().

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

Initial value:

 EXPONENT_MIN
                                        - static_cast<int>(MANTISSA_BITS)

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


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

Generated on Wed Jul 16 22:55:44 2008 for PPL by  doxygen 1.5.6