PPL  1.2
Parma_Polyhedra_Library::float_ieee754_single Struct Reference

#include <Float_defs.hh>

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

uint32_t word
 

Static Public Attributes

static const uint32_t SGN_MASK = 0x80000000U
 
static const uint32_t EXP_MASK = 0x7f800000U
 
static const uint32_t WRD_MAX = 0x7f7fffffU
 
static const uint32_t POS_INF = 0x7f800000U
 
static const uint32_t NEG_INF = 0xff800000U
 
static const uint32_t POS_ZERO = 0x00000000U
 
static const uint32_t NEG_ZERO = 0x80000000U
 
static const unsigned int BASE = 2
 
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
 
static const Floating_Point_Format floating_point_format = IEEE754_SINGLE
 

Detailed Description

Definition at line 82 of file Float_defs.hh.

Member Function Documentation

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

Definition at line 157 of file Float_inlines.hh.

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

157  {
158  word = static_cast<uint32_t>(mpz_get_ui(mantissa)
159  & ((1UL << MANTISSA_BITS) - 1));
160  if (negative) {
161  word |= SGN_MASK;
162  }
163  const int exponent_repr = exponent + EXPONENT_BIAS;
164  PPL_ASSERT(exponent_repr >= 0 && exponent_repr < (1 << EXPONENT_BITS));
165  word |= static_cast<uint32_t>(exponent_repr) << MANTISSA_BITS;
166 }
static const unsigned int MANTISSA_BITS
Definition: Float_defs.hh:93
static const unsigned int EXPONENT_BITS
Definition: Float_defs.hh:92
void Parma_Polyhedra_Library::float_ieee754_single::dec ( )
inline

Definition at line 139 of file Float_inlines.hh.

References word.

139  {
140  --word;
141 }
void Parma_Polyhedra_Library::float_ieee754_single::inc ( )
inline

Definition at line 144 of file Float_inlines.hh.

References word.

144  {
145  ++word;
146 }
int Parma_Polyhedra_Library::float_ieee754_single::inf_sign ( ) const
inline

Definition at line 102 of file Float_inlines.hh.

References NEG_INF, POS_INF, and word.

102  {
103  if (word == NEG_INF) {
104  return -1;
105  }
106  if (word == POS_INF) {
107  return 1;
108  }
109  return 0;
110 }
bool Parma_Polyhedra_Library::float_ieee754_single::is_nan ( ) const
inline

Definition at line 113 of file Float_inlines.hh.

References POS_INF, SGN_MASK, and word.

void Parma_Polyhedra_Library::float_ieee754_single::negate ( )
inline

Definition at line 129 of file Float_inlines.hh.

References SGN_MASK, and word.

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

Definition at line 149 of file Float_inlines.hh.

References SGN_MASK, word, and WRD_MAX.

149  {
150  word = WRD_MAX;
151  if (negative) {
152  word |= SGN_MASK;
153  }
154 }
bool Parma_Polyhedra_Library::float_ieee754_single::sign_bit ( ) const
inline

Definition at line 134 of file Float_inlines.hh.

References SGN_MASK, and word.

134  {
135  return (word & SGN_MASK) != 0;
136 }
int Parma_Polyhedra_Library::float_ieee754_single::zero_sign ( ) const
inline

Definition at line 118 of file Float_inlines.hh.

References NEG_ZERO, POS_ZERO, and word.

118  {
119  if (word == NEG_ZERO) {
120  return -1;
121  }
122  if (word == POS_ZERO) {
123  return 1;
124  }
125  return 0;
126 }

Member Data Documentation

const unsigned int Parma_Polyhedra_Library::float_ieee754_single::BASE = 2
static
const uint32_t Parma_Polyhedra_Library::float_ieee754_single::EXP_MASK = 0x7f800000U
static

Definition at line 85 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ieee754_single::EXPONENT_BIAS = EXPONENT_MAX
static

Definition at line 95 of file Float_defs.hh.

Referenced by build(), and Parma_Polyhedra_Library::compute_absolute_error().

const unsigned int Parma_Polyhedra_Library::float_ieee754_single::EXPONENT_BITS = 8
static

Definition at line 92 of file Float_defs.hh.

Referenced by build().

const int Parma_Polyhedra_Library::float_ieee754_single::EXPONENT_MAX = (1 << (EXPONENT_BITS - 1)) - 1
static

Definition at line 94 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ieee754_single::EXPONENT_MIN = -EXPONENT_MAX + 1
static

Definition at line 96 of file Float_defs.hh.

const int Parma_Polyhedra_Library::float_ieee754_single::EXPONENT_MIN_DENORM
static
Initial value:
- static_cast<int>(MANTISSA_BITS)

Definition at line 97 of file Float_defs.hh.

const Floating_Point_Format Parma_Polyhedra_Library::float_ieee754_single::floating_point_format = IEEE754_SINGLE
static

Definition at line 99 of file Float_defs.hh.

const unsigned int Parma_Polyhedra_Library::float_ieee754_single::MANTISSA_BITS = 23
static
const uint32_t Parma_Polyhedra_Library::float_ieee754_single::NEG_INF = 0xff800000U
static

Definition at line 88 of file Float_defs.hh.

Referenced by inf_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::NEG_ZERO = 0x80000000U
static

Definition at line 90 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::POS_INF = 0x7f800000U
static

Definition at line 87 of file Float_defs.hh.

Referenced by inf_sign(), and is_nan().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::POS_ZERO = 0x00000000U
static

Definition at line 89 of file Float_defs.hh.

Referenced by zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::SGN_MASK = 0x80000000U
static

Definition at line 84 of file Float_defs.hh.

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

uint32_t Parma_Polyhedra_Library::float_ieee754_single::word

Definition at line 83 of file Float_defs.hh.

Referenced by build(), dec(), inc(), inf_sign(), is_nan(), negate(), set_max(), sign_bit(), and zero_sign().

const uint32_t Parma_Polyhedra_Library::float_ieee754_single::WRD_MAX = 0x7f7fffffU
static

Definition at line 86 of file Float_defs.hh.

Referenced by set_max().


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