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


Member Function Documentation

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

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

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

00089                                    {
00090   if (lsp != LSP_INF)
00091     return 0;
00092   if (msp == MSP_NEG_INF)
00093     return -1;
00094   if (msp == MSP_POS_INF)
00095     return 1;
00096   return 0;
00097 }

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

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

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

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

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

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

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

00106                                     {
00107   if (lsp != LSP_ZERO)
00108     return 0;
00109   if (msp == MSP_NEG_ZERO)
00110     return -1;
00111   if (msp == MSP_POS_ZERO)
00112     return 1;
00113   return 0;
00114 }

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

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

References msp, and MSP_SGN_MASK.

00122                                      {
00123   return !!(msp & MSP_SGN_MASK);
00124 }

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

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

References msp, and MSP_SGN_MASK.

00117                              {
00118   msp ^= MSP_SGN_MASK;
00119 }

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

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

References lsp, LSP_MAX, and msp.

00127                           {
00128   if (lsp == 0) {
00129     --msp;
00130     lsp = LSP_MAX;
00131   }
00132   else
00133     --lsp;
00134 }

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

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

References lsp, LSP_MAX, and msp.

00137                           {
00138   if (lsp == LSP_MAX) {
00139     ++msp;
00140     lsp = 0;
00141   }
00142   else
00143     ++lsp;
00144 }

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

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

References lsp, msp, and MSP_SGN_MASK.

00147                                            {
00148   msp = 0x7fefffff;
00149   lsp = 0xffffffff;
00150   if (negative)
00151     msp |= MSP_SGN_MASK;
00152 }

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

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

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

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


Member Data Documentation

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

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

Definition at line 78 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 80 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 81 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 82 of file Float.defs.hh.

Referenced by is_inf().

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

Referenced by is_zero().

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

Referenced by is_zero().

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

Referenced by is_inf(), and is_nan().

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

Referenced by dec(), and inc().

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

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

Referenced by build().

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

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

Referenced by build().

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

Initial value:

 EXPONENT_MIN
                                        - static_cast<int>(MANTISSA_BITS)

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


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

Generated on Sat Oct 11 10:41:01 2008 for PPL by  doxygen 1.5.6