25 #ifndef PPL_Float_templates_hh
26 #define PPL_Float_templates_hh 1
34 template <
typename FP_Interval_Type>
37 typedef typename FP_Interval_Type::boundary_type analyzer_format;
40 static const FP_Interval_Type ZERO_INTERVAL = FP_Interval_Type(0);
42 static FP_Interval_Type ieee754_half_result = ZERO_INTERVAL;
43 static FP_Interval_Type ieee754_single_result = ZERO_INTERVAL;
44 static FP_Interval_Type ieee754_double_result = ZERO_INTERVAL;
45 static FP_Interval_Type ibm_single_result = ZERO_INTERVAL;
46 static FP_Interval_Type ieee754_quad_result = ZERO_INTERVAL;
47 static FP_Interval_Type intel_double_extended_result = ZERO_INTERVAL;
49 FP_Interval_Type* to_compute = NULL;
53 unsigned int f_mantissa_bits;
54 switch (analyzed_format) {
56 if (ieee754_half_result != ZERO_INTERVAL) {
57 return ieee754_half_result;
59 to_compute = &ieee754_half_result;
65 if (ieee754_single_result != ZERO_INTERVAL) {
66 return ieee754_single_result;
69 to_compute = &ieee754_single_result;
75 if (ieee754_double_result != ZERO_INTERVAL) {
76 return ieee754_double_result;
79 to_compute = &ieee754_double_result;
85 if (ibm_single_result != ZERO_INTERVAL) {
86 return ibm_single_result;
89 to_compute = &ibm_single_result;
95 if (ieee754_quad_result != ZERO_INTERVAL) {
96 return ieee754_quad_result;
99 to_compute = &ieee754_quad_result;
105 if (intel_double_extended_result != ZERO_INTERVAL) {
106 return intel_double_extended_result;
109 to_compute = &intel_double_extended_result;
119 PPL_ASSERT(to_compute != NULL);
122 analyzer_format omega;
124 * ((1 - f_exponent_bias) -
static_cast<int>(f_mantissa_bits));
125 omega = std::max(static_cast<analyzer_format>(ldexp(1.0, power)),
126 std::numeric_limits<analyzer_format>::denorm_min());
133 template <
typename FP_Interval_Type>
139 typedef typename std::map<dimension_type, FP_Linear_Form>::iterator Iter;
140 for (Iter i = lf_store.begin(); i != lf_store.end(); ) {
141 if ((i->second).coefficient(var) != 0) {
142 i = lf_store.erase(i);
152 template <
typename FP_Interval_Type>
158 typedef typename std::map<dimension_type, FP_Linear_Form>::iterator Iter;
160 FP_Linear_Form>::const_iterator Const_Iter;
162 Const_Iter i2_end = ls2.end();
163 for (Iter i1 = ls1.begin(), i1_end = ls1.end(); i1 != i1_end; ) {
164 Const_Iter i2 = ls2.find(i1->first);
165 if ((i2 == i2_end) || (i1->second != i2->second)) {
176 #endif // !defined(PPL_Float_templates_hh)
static const unsigned int BASE
I_Constraint< T > i_constraint(I_Constraint_Rel rel, const T &v)
static const unsigned int BASE
static const unsigned int MANTISSA_BITS
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).
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)
IBM single precision, 32 bits (7 exponent, 24 mantissa).
static const int EXPONENT_BIAS
static const unsigned int BASE
static const unsigned int BASE
static const unsigned int BASE
static const int EXPONENT_BIAS
const FP_Interval_Type & compute_absolute_error(const Floating_Point_Format analyzed_format)
unsigned int msb_position(unsigned long long v)
If v is nonzero, returns the position of the most significant bit in a.
A dimension of the vector space.
Intel double extended precision, 80 bits (15 exponent, 64 mantissa)
Greater than or equal to.
static const unsigned int MANTISSA_BITS
static const unsigned int BASE
static const unsigned int MANTISSA_BITS
static const int EXPONENT_BIAS
static const int EXPONENT_BIAS
The entire library is confined to this namespace.
IEEE 754 double precision, 64 bits (11 exponent, 52 mantissa).
IEEE 754 single precision, 32 bits (8 exponent, 23 mantissa).
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)
static const unsigned int MANTISSA_BITS
static const unsigned int MANTISSA_BITS
static const int EXPONENT_BIAS
static const int EXPONENT_BIAS