Parma_Polyhedra_Library::float_ieee754_single 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 word

Static Public Attributes

static const uint32_t SGN_MASK = 0x80000000
static const uint32_t EXP_MASK = 0x7f800000
static const uint32_t POS_INF = 0x7f800000
static const uint32_t NEG_INF = 0xff800000
static const uint32_t POS_ZERO = 0x00000000
static const uint32_t NEG_ZERO = 0x80000000
static const unsigned int EXPONENT_BITS = 8
static const unsigned int MANTISSA_BITS = 23
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 42 of file Float.defs.hh.


Member Function Documentation

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

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

References NEG_INF, POS_INF, and word.

00031                                    {
00032   if (word == NEG_INF)
00033     return -1;
00034   if (word == POS_INF)
00035     return 1;
00036   return 0;
00037 }

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

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

References POS_INF, SGN_MASK, and word.

00040                                    {
00041   return (word & ~SGN_MASK) > POS_INF;
00042 }

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

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

References NEG_ZERO, POS_ZERO, and word.

00045                                     {
00046   if (word == NEG_ZERO)
00047     return -1;
00048   if (word == POS_ZERO)
00049     return 1;
00050   return 0;
00051 }

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

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

References SGN_MASK, and word.

00059                                      {
00060   return !!(word & SGN_MASK);
00061 }

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

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

References SGN_MASK, and word.

00054                              {
00055   word ^= SGN_MASK;
00056 }

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

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

References word.

00064                           {
00065   --word;
00066 }

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

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

References word.

00069                           {
00070   ++word;
00071 }

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

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

References SGN_MASK, and word.

00074                                            {
00075   word = 0x7f7fffff;
00076   if (negative)
00077     word |= SGN_MASK;
00078 }

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

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

References EXPONENT_BIAS, MANTISSA_BITS, SGN_MASK, and word.

00081                                                                        {
00082   word = mpz_get_ui(mantissa) & ((1UL << MANTISSA_BITS) - 1);
00083   if (negative)
00084     word |= SGN_MASK;
00085   word |= static_cast<uint32_t>(exponent + EXPONENT_BIAS) << MANTISSA_BITS;
00086 }


Member Data Documentation

Definition at line 43 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_single::SGN_MASK = 0x80000000 [static]

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

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

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::EXP_MASK = 0x7f800000 [static]

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

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::POS_INF = 0x7f800000 [static]

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

Referenced by is_inf(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::NEG_INF = 0xff800000 [static]

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

Referenced by is_inf().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::POS_ZERO = 0x00000000 [static]

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

Referenced by is_zero().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::NEG_ZERO = 0x80000000 [static]

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

Referenced by is_zero().

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

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

Referenced by build().

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

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

Referenced by build().

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

Initial value:

 EXPONENT_MIN
                                        - static_cast<int>(MANTISSA_BITS)

Definition at line 55 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