24 #ifndef PPL_Float_defs_hh
25 #define PPL_Float_defs_hh 1
41 #define PPL_NAN (HUGE_VAL - HUGE_VAL)
46 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
48 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
58 static const unsigned int BASE = 2;
75 void build(
bool negative, mpz_t mantissa,
int exponent);
79 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
81 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
86 static const uint32_t
WRD_MAX = 0x7f7fffffU;
87 static const uint32_t
POS_INF = 0x7f800000U;
88 static const uint32_t
NEG_INF = 0xff800000U;
91 static const unsigned int BASE = 2;
108 void build(
bool negative, mpz_t mantissa,
int exponent);
111 #ifdef WORDS_BIGENDIAN
112 #ifndef PPL_WORDS_BIGENDIAN
113 #define PPL_WORDS_BIGENDIAN
117 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
119 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
121 #ifdef PPL_WORDS_BIGENDIAN
137 static const unsigned int BASE = 2;
154 void build(
bool negative, mpz_t mantissa,
int exponent);
157 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
159 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
169 static const unsigned int BASE = 16;
186 void build(
bool negative, mpz_t mantissa,
int exponent);
189 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
191 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
193 static const unsigned int BASE = 16;
199 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
201 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
203 #ifdef PPL_WORDS_BIGENDIAN
215 static const uint64_t
LSP_INF =
static_cast<uint64_t
>(0x8000000000000000ULL);
218 static const uint64_t
LSP_DMAX =
static_cast<uint64_t
>(0x7fffffffffffffffULL);
219 static const uint64_t
LSP_NMAX =
static_cast<uint64_t
>(0xffffffffffffffffULL);
220 static const unsigned int BASE = 2;
238 void build(
bool negative, mpz_t mantissa,
int exponent);
241 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
243 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
245 #ifdef PPL_WORDS_BIGENDIAN
252 static const uint64_t
MSP_SGN_MASK =
static_cast<uint64_t
>(0x8000000000000000ULL);
253 static const uint64_t
MSP_POS_INF =
static_cast<uint64_t
>(0x7fff000000000000ULL);
254 static const uint64_t
MSP_NEG_INF =
static_cast<uint64_t
>(0xffff000000000000ULL);
255 static const uint64_t
MSP_POS_ZERO =
static_cast<uint64_t
>(0x0000000000000000ULL);
256 static const uint64_t
MSP_NEG_ZERO =
static_cast<uint64_t
>(0x8000000000000000ULL);
259 static const uint64_t
MSP_MAX =
static_cast<uint64_t
>(0x7ffeffffffffffffULL);
260 static const uint64_t
LSP_MAX =
static_cast<uint64_t
>(0xffffffffffffffffULL);
261 static const unsigned int BASE = 2;
278 void build(
bool negative, mpz_t mantissa,
int exponent);
281 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
283 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
284 template <
typename T>
287 #if PPL_SUPPORTED_FLOAT
291 #if PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_IEEE754_HALF
293 #elif PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_IEEE754_SINGLE
295 #elif PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_IEEE754_DOUBLE
297 #elif PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_IBM_SINGLE
299 #elif PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_IEEE754_QUAD
301 #elif PPL_CXX_FLOAT_BINARY_FORMAT == PPL_FLOAT_INTEL_DOUBLE_EXTENDED
304 #error "Invalid value for PPL_CXX_FLOAT_BINARY_FORMAT"
316 #if PPL_SUPPORTED_DOUBLE
318 class Float<double> :
public True {
320 #if PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_HALF
321 typedef float_ieee754_half Binary;
322 #elif PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_SINGLE
323 typedef float_ieee754_single Binary;
324 #elif PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_DOUBLE
325 typedef float_ieee754_double Binary;
326 #elif PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IBM_SINGLE
327 typedef float_ibm_single Binary;
328 #elif PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_QUAD
329 typedef float_ieee754_quad Binary;
330 #elif PPL_CXX_DOUBLE_BINARY_FORMAT == PPL_FLOAT_INTEL_DOUBLE_EXTENDED
331 typedef float_intel_double_extended Binary;
333 #error "Invalid value for PPL_CXX_DOUBLE_BINARY_FORMAT"
345 #if PPL_SUPPORTED_LONG_DOUBLE
347 class Float<
long double> :
public True {
349 #if PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_HALF
350 typedef float_ieee754_half Binary;
351 #elif PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_SINGLE
352 typedef float_ieee754_single Binary;
353 #elif PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_DOUBLE
354 typedef float_ieee754_double Binary;
355 #elif PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IBM_SINGLE
356 typedef float_ibm_single Binary;
357 #elif PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_IEEE754_QUAD
358 typedef float_ieee754_quad Binary;
359 #elif PPL_CXX_LONG_DOUBLE_BINARY_FORMAT == PPL_FLOAT_INTEL_DOUBLE_EXTENDED
360 typedef float_intel_double_extended Binary;
362 #error "Invalid value for PPL_CXX_LONG_DOUBLE_BINARY_FORMAT"
369 Float(
long double v);
375 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
382 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
398 template <
typename Target,
typename FP_Interval_Type>
427 FP_Interval_Type& result)
const = 0;
438 FP_Interval_Type& result)
const = 0;
452 std::set<dimension_type>& result)
const = 0;
481 template <
typename FP_Interval_Type>
482 const FP_Interval_Type&
489 template <
typename FP_Interval_Type>
499 template <
typename FP_Interval_Type>
510 template <
typename FP_Interval_Type>
522 #endif // !defined(PPL_Float_defs_hh)
static const uint32_t POS_ZERO
static const int EXPONENT_MAX
static const unsigned int BASE
static const uint64_t LSP_DMAX
static const unsigned int BASE
static const unsigned int MANTISSA_BITS
static const uint32_t MSP_NEG_INF
static const uint32_t NEG_ZERO
static const Floating_Point_Format floating_point_format
void affine_form_image(std::map< dimension_type, Linear_Form< FP_Interval_Type > > &lf_store, const Variable var, const Linear_Form< FP_Interval_Type > &lf)
virtual bool get_interval(dimension_type dim, FP_Interval_Type &result) const =0
Asks the external analyzer for an interval that correctly approximates the floating point entity refe...
virtual bool get_fp_constant_value(const Floating_Point_Constant< Target > &expr, FP_Interval_Type &result) const =0
Asks the external analyzer for an interval that correctly approximates the value of floating point co...
An abstract class to be implemented by an external analyzer such as ECLAIR in order to provide to the...
static const int EXPONENT_MIN
static const uint16_t WRD_MAX
void set_max(bool negative)
static const int EXPONENT_MIN_DENORM
static const uint64_t MSP_POS_ZERO
static const int EXPONENT_MIN_DENORM
size_t dimension_type
An unsigned integral type for representing space dimensions.
static const unsigned int MANTISSA_BITS
IEEE 754 half precision, 16 bits (5 exponent, 10 mantissa).
static const int EXPONENT_MIN_DENORM
void set_max(bool negative)
IEEE 754 quad precision, 128 bits (15 exponent, 112 mantissa).
void discard_occurrences(std::map< dimension_type, Linear_Form< FP_Interval_Type > > &lf_store, Variable var)
static const uint32_t POS_ZERO
IBM single precision, 32 bits (7 exponent, 24 mantissa).
static const uint32_t LSP_INF
static const uint32_t NEG_INF
static const int EXPONENT_BIAS
static const uint16_t POS_INF
static const int EXPONENT_MIN
static const unsigned int BASE
static const unsigned int BASE
static const unsigned int BASE
static const unsigned int EXPONENT_BITS
static const uint32_t LSP_MAX
static const int EXPONENT_MIN_DENORM
void build(bool negative, mpz_t mantissa, int exponent)
static const int EXPONENT_MAX
static const uint64_t MSP_SGN_MASK
static const Floating_Point_Format floating_point_format
static const uint32_t WRD_MAX
static const uint16_t EXP_MASK
static const uint64_t LSP_NMAX
static const int EXPONENT_BIAS
static const uint32_t MSP_NEG_ZERO
const FP_Interval_Type & compute_absolute_error(const Floating_Point_Format analyzed_format)
signed signed signed signed signed char signed signed signed signed signed int signed long long
static const uint64_t LSP_INF
static const int EXPONENT_MIN
unsigned int msb_position(unsigned long long v)
If v is nonzero, returns the position of the most significant bit in a.
static const uint16_t POS_ZERO
static const unsigned int EXPONENT_BITS
static const int EXPONENT_MAX
static const Floating_Point_Format floating_point_format
static const unsigned int MANTISSA_BITS
A dimension of the vector space.
static const int EXPONENT_MIN_DENORM
static const uint16_t SGN_MASK
static const uint32_t EXP_MASK
static const Floating_Point_Format floating_point_format
static const uint32_t EXP_MASK
static const uint64_t MSP_POS_INF
Intel double extended precision, 80 bits (15 exponent, 64 mantissa)
static const uint64_t LSP_ZERO
bool is_less_precise_than(Floating_Point_Format f1, Floating_Point_Format f2)
static const int EXPONENT_MAX
static const uint16_t NEG_ZERO
static const int EXPONENT_BIAS
static const uint32_t POS_INF
static const int EXPONENT_MAX
void build(bool negative, mpz_t mantissa, int exponent)
A concrete expression representing a reference to some approximable.
A class holding a constant called value that evaluates to true.
static const uint32_t MSP_POS_INF
static const unsigned int MANTISSA_BITS
static const uint32_t MSP_NEG_ZERO
static const uint32_t MSP_POS_ZERO
virtual bool get_associated_dimensions(const Approximable_Reference< Target > &expr, std::set< dimension_type > &result) const =0
Asks the external analyzer for the possible space dimensions that are associated to the approximable ...
static const unsigned int EXPONENT_BITS
static const uint32_t MSP_NEG_INF
static const uint64_t MSP_MAX
void build(bool negative, mpz_t mantissa, int exponent)
static const uint32_t NEG_INF
static const uint64_t LSP_MAX
static const unsigned int BASE
static const uint32_t MSP_MAX
static const uint32_t LSP_ZERO
static const unsigned int EXPONENT_BITS
static const Floating_Point_Format floating_point_format
static const int EXPONENT_MIN
static const uint32_t SGN_MASK
static const unsigned int MANTISSA_BITS
static const uint32_t SGN_MASK
static const int EXPONENT_BIAS
The base class of all concrete expressions.
void build(bool negative, mpz_t mantissa, int exponent)
static const int EXPONENT_BIAS
virtual bool get_integer_expr_value(const Concrete_Expression< Target > &expr, FP_Interval_Type &result) const =0
Asks the external analyzer for an interval that correctly approximates the value of expr...
void set_max(bool negative)
static const uint32_t MSP_MAX
static const uint32_t POS_INF
static const unsigned int EXPONENT_BITS
static const uint64_t MSP_NEG_ZERO
static const Floating_Point_Format floating_point_format
static const int EXPONENT_MIN_DENORM
The entire library is confined to this namespace.
static const int EXPONENT_MIN
IEEE 754 double precision, 64 bits (11 exponent, 52 mantissa).
static const unsigned int EXPONENT_BITS
static const uint64_t MSP_NEG_INF
void set_max(bool negative)
static const unsigned int BASE
static const uint32_t MSP_POS_INF
IEEE 754 single precision, 32 bits (8 exponent, 23 mantissa).
A floating-point constant concrete expression.
void set_max(bool negative)
static const int EXPONENT_MIN
void build(bool negative, mpz_t mantissa, int exponent)
void set_max(bool negative)
static const uint16_t NEG_INF
static const uint32_t NEG_ZERO
static const uint64_t LSP_INF
void build(bool negative, mpz_t mantissa, int exponent)
static const uint32_t WRD_MAX
static const uint32_t MSP_SGN_MASK
void upper_bound_assign(std::map< dimension_type, Linear_Form< FP_Interval_Type > > &ls1, const std::map< dimension_type, Linear_Form< FP_Interval_Type > > &ls2)
A class holding a constant called value that evaluates to false.
static const unsigned int EXPONENT_BITS
static const unsigned int MANTISSA_BITS
static const unsigned int MANTISSA_BITS
static const int EXPONENT_BIAS
static const uint32_t MSP_POS_ZERO
static const uint32_t MSP_SGN_MASK
static const uint64_t LSP_ZERO
static const int EXPONENT_BIAS
static const int EXPONENT_MAX