PPL  0.12.1
Parma_Polyhedra_Library::float_ieee754_half Struct Reference

#include <Float.defs.hh>

List of all members.

Public Member Functions

int inf_sign () const
bool is_nan () const
int zero_sign () const
bool 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 = 0x8000U
static const uint16_t EXP_MASK = 0xfc00U
static const uint16_t POS_INF = 0xfc00U
static const uint16_t NEG_INF = 0x7c00U
static const uint16_t POS_ZERO = 0x0000U
static const uint16_t NEG_ZERO = 0x8000U
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
static const Floating_Point_Format floating_point_format = IEEE754_HALF

Detailed Description

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

References EXPONENT_BIAS, EXPONENT_BITS, MANTISSA_BITS, PPL_ASSERT, SGN_MASK, and word.

                                                                     {
  word = static_cast<uint16_t>(mpz_get_ui(mantissa)
                               & ((1UL << MANTISSA_BITS) - 1));
  if (negative)
    word |= SGN_MASK;
  int exponent_repr = exponent + EXPONENT_BIAS;
  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
  word |= static_cast<uint16_t>(exponent_repr) << MANTISSA_BITS;
}

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

References word.

                        {
  --word;
}

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

References word.

                        {
  ++word;
}

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

References NEG_INF, POS_INF, and word.

                                   {
  if (word == NEG_INF)
    return -1;
  if (word == POS_INF)
    return 1;
  return 0;
}

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

References POS_INF, SGN_MASK, and word.

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

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

References SGN_MASK, and word.

                           {
  word ^= SGN_MASK;
}

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

References SGN_MASK, and word.

                                         {
  word = 0x7bffU;
  if (negative)
    word |= SGN_MASK;
}

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

References SGN_MASK, and word.

                                   {
  return (word & SGN_MASK) != 0;
}

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

References NEG_ZERO, POS_ZERO, and word.

                                    {
  if (word == NEG_ZERO)
    return -1;
  if (word == POS_ZERO)
    return 1;
  return 0;
}

Member Data Documentation

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

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

Referenced by build().

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

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

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

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

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

Referenced by inf_sign().

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

Referenced by zero_sign().

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

Referenced by inf_sign(), and is_nan().

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

Referenced by zero_sign().

Definition at line 52 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: