[PPL-devel] [GIT] ppl/ppl(floating_point): Added more floating point formats.
Fabio Bossi
bossi at cs.unipr.it
Mon Sep 21 16:56:15 CEST 2009
Module: ppl/ppl
Branch: floating_point
Commit: 7365b420d7ab0984de1d19f7764c24892d5dff38
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=7365b420d7ab0984de1d19f7764c24892d5dff38
Author: Fabio Bossi <bossi at cs.unipr.it>
Date: Mon Sep 21 16:59:22 2009 +0200
Added more floating point formats.
Added some parametric typedefs for tests.
---
src/Floating_Point_Expression.defs.hh | 28 ++++++++++++++++++
tests/ppl_test.hh | 50 +++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/src/Floating_Point_Expression.defs.hh b/src/Floating_Point_Expression.defs.hh
index 71b77ad..ec21e1b 100644
--- a/src/Floating_Point_Expression.defs.hh
+++ b/src/Floating_Point_Expression.defs.hh
@@ -34,6 +34,13 @@ namespace Parma_Polyhedra_Library {
//! Exception class indicating the failure of a linearization attempt.
class Linearization_Failed {};
+//! Policy class defining the IEEE754 half precision format.
+struct IEEE754_Half {
+ static const unsigned short fraction_bits = 10;
+ static const unsigned short exponent_bits = 5;
+ static const unsigned short exponent_bias = 15;
+};
+
//! Policy class defining the IEEE754 single precision format.
struct IEEE754_Single {
static const unsigned short fraction_bits = 23;
@@ -48,6 +55,27 @@ struct IEEE754_Double {
static const unsigned short exponent_bias = 1023;
};
+//! Policy class defining the IEEE754 quadruple precision format.
+struct IEEE754_Quadruple {
+ static const unsigned short fraction_bits = 112;
+ static const unsigned short exponent_bits = 15;
+ static const unsigned short exponent_bias = 16383;
+};
+
+//! Policy class defining the IBM single precision format.
+struct IBM_Single {
+ static const unsigned short fraction_bits = 24;
+ static const unsigned short exponent_bits = 7;
+ static const unsigned short exponent_bias = 64;
+};
+
+//! Policy class defining the IBM double precision format.
+struct IBM_Double {
+ static const unsigned short fraction_bits = 56;
+ static const unsigned short exponent_bits = 7;
+ static const unsigned short exponent_bias = 64;
+};
+
/*! \brief
\ingroup PPL_CXX_Interface
A floating point expression on a given format.
diff --git a/tests/ppl_test.hh b/tests/ppl_test.hh
index ff7e1eb..628c3a0 100644
--- a/tests/ppl_test.hh
+++ b/tests/ppl_test.hh
@@ -29,6 +29,7 @@ site: http://www.cs.unipr.it/ppl/ . */
#include <stdexcept>
#include <sstream>
#include <list>
+#include <map>
#include <iterator>
#include <string>
#include <iostream>
@@ -513,6 +514,19 @@ struct Floating_Real_Open_Interval_Info_Policy {
const_bool_nodef(check_inexact, false);
};
+struct Floating_Real_Closed_Interval_Info_Policy {
+ const_bool_nodef(store_special, false);
+ const_bool_nodef(store_open, false);
+ const_bool_nodef(cache_empty, false);
+ const_bool_nodef(cache_singleton, true);
+ const_bool_nodef(cache_normalized, false);
+ const_int_nodef(next_bit, 0);
+ const_bool_nodef(may_be_empty, false);
+ const_bool_nodef(may_contain_infinity, false);
+ const_bool_nodef(check_empty_result, false);
+ const_bool_nodef(check_inexact, false);
+};
+
typedef Interval_Restriction_None
<Interval_Info_Bitset<unsigned int, Floating_Real_Open_Interval_Info_Policy> >
Floating_Real_Open_Interval_Info;
@@ -549,6 +563,42 @@ typedef BD_Shape<BD_SHAPE_INSTANCE> TBD_Shape;
//! The incarnation of Octagonal_Shape under test.
typedef Octagonal_Shape<OCTAGONAL_SHAPE_INSTANCE> TOctagonal_Shape;
+// For floating point analysis.
+#ifdef ANALYZER_FP_FORMAT
+#ifdef ANALYZED_FP_FORMAT
+//! The type of an interval with floating point boundaries.
+typedef Interval<ANALYZER_FP_FORMAT,
+ Floating_Real_Closed_Interval_Info_Policy> FP_Interval;
+
+//! The type of an interval linear form.
+typedef Linear_Form<FP_Interval> FP_Linear_Form;
+
+//! The type of an interval abstract store.
+typedef std::map<dimension_type, FP_Interval> FP_Interval_Abstract_Store;
+
+//! The type of a linear form abstract store.
+typedef std::map<dimension_type, FP_Linear_Form> FP_Linear_Form_Abstract_Store;
+
+/*! \brief
+ The incarnation of Floating_Point_Expression under test for analyzing
+ floating point computations.
+*/
+typedef Floating_Point_Expression<FP_Interval_Type, ANALYZED_FP_FORMAT> FP_Expression;
+
+/*! \brief
+ The incarnation of BD_Shape under test for analyzing
+ floating point computations.
+*/
+typedef BD_Shape<ANALYZER_FP_FORMAT> FP_BD_Shape;
+
+/*! \brief
+ The incarnation of Octagon under test for analyzing
+ floating point computations.
+*/
+typedef Octagon<ANALYZER_FP_FORMAT> FP_Octagon;
+#endif
+#endif
+
template <typename Shape>
inline bool
has_exact_coefficient_type(const Shape&) {
More information about the PPL-devel
mailing list