Parma_Polyhedra_Library::float_ieee754_half 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

uint16_t word

Static Public Attributes

static const uint16_t SGN_MASK = 0x8000
static const uint16_t EXP_MASK = 0xfc00
static const uint16_t POS_INF = 0xfc00
static const uint16_t NEG_INF = 0x7c00
static const uint16_t POS_ZERO = 0x0000
static const uint16_t NEG_ZERO = 0x8000
static const unsigned int BASE = 2
static const unsigned int EXPONENT_BITS = 5
static const unsigned int MANTISSA_BITS = 10
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 45 of file Float.defs.hh.


Member Function Documentation

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

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

References EXPONENT_BIAS, MANTISSA_BITS, SGN_MASK, and word.

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

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

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

References word.

00065                         {
00066   --word;
00067 }

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

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

References word.

00070                         {
00071   ++word;
00072 }

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

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

References NEG_INF, POS_INF, and word.

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

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

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

References POS_INF, SGN_MASK, and word.

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

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

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

References NEG_ZERO, POS_ZERO, and word.

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

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

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

References SGN_MASK, and word.

00055                            {
00056   word ^= SGN_MASK;
00057 }

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

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

References SGN_MASK, and word.

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

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

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

References SGN_MASK, and word.

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


Member Data Documentation

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

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

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

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

Referenced by build().

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

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

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

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

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

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

Referenced by build().

const uint16_t Parma_Polyhedra_Library::float_ieee754_half::NEG_INF = 0x7c00 [static]

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

Referenced by is_inf().

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

Referenced by is_zero().

const uint16_t Parma_Polyhedra_Library::float_ieee754_half::POS_INF = 0xfc00 [static]

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

Referenced by is_inf(), and is_nan().

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

Referenced by is_zero().

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

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

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

Referenced by build(), dec(), inc(), is_inf(), is_nan(), is_zero(), 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