[PPL-devel] [GIT] ppl/ppl(master): Do not assume doubles are supported.

Roberto Bagnara bagnara at cs.unipr.it
Tue Mar 27 07:03:47 CEST 2012


Module: ppl/ppl
Branch: master
Commit: b5f8abc4dc994c7df3c5532090951df4b12fa596
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b5f8abc4dc994c7df3c5532090951df4b12fa596

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Tue Mar 27 07:03:19 2012 +0200

Do not assume doubles are supported.

---

 configure.ac           |    2 +-
 tests/Box/interval1.cc |   19 ++++++++++---------
 tests/Box/membytes1.cc |   16 ++++++++++------
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6b0163e..66fe9f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@
 # Process this file with Autoconf to produce a configure script.
 
 # Every other copy of the package version number gets its value from here.
-AC_INIT([the Parma Polyhedra Library], [0.12.1pre1], [ppl-devel at cs.unipr.it], [ppl])
+AC_INIT([the Parma Polyhedra Library], [0.12.1pre2], [ppl-devel at cs.unipr.it], [ppl])
 
 # Minimum Autoconf version required.
 AC_PREREQ(2.61)
diff --git a/tests/Box/interval1.cc b/tests/Box/interval1.cc
index fdaa861..ff5fae7 100644
--- a/tests/Box/interval1.cc
+++ b/tests/Box/interval1.cc
@@ -46,7 +46,8 @@ struct My_Interval {
   };
 
   typedef Interval_Info_Bitset<unsigned int,
-                               Floating_Point_Real_Interval_Info_Policy> Floating_Point_Real_Interval_Info;
+                               Floating_Point_Real_Interval_Info_Policy>
+  Floating_Point_Real_Interval_Info;
 
   typedef Interval<F, Floating_Point_Real_Interval_Info> interval_type;
 };
@@ -71,15 +72,15 @@ test01() {
     nout << "x = " << x << endl;
   }
 
-  typename My_Interval<F>::interval_type z(1.41420757770538330078125);
-  z.join_assign(1.41421949863433837890625);
+  typename My_Interval<F>::interval_type z(F(1.41420757770538330078125));
+  z.join_assign(F(1.41421949863433837890625));
 
   nout << "z = " << x << endl;
 
   return !x.is_empty()
 #if PPL_CXX_SUPPORTS_IEEE_INEXACT_FLAG
-    && x.is_disjoint_from(1.41420757770538330078125)
-    && x.is_disjoint_from(1.41421949863433837890625)
+    && x.is_disjoint_from(F(1.41420757770538330078125))
+    && x.is_disjoint_from(F(1.41421949863433837890625))
     && z.strictly_contains(x)
 #else
     && x.is_topologically_closed()
@@ -96,7 +97,7 @@ polynomial_evaluate(const std::vector<N>& P,
                     const std::complex<N>& x,
                     std::complex<N>& P_x) {
   // Note: the coefficient of the leading term is implicitly 1.
-  P_x = std::complex<N>(N(1.0), N(0.0));
+  P_x = std::complex<N>(N(1), N(0));
   for (int i = P.size(); i >= 1; --i)
     P_x = P_x*x + P[i-1];
 }
@@ -124,7 +125,7 @@ solve(const std::vector<N>& P,
     for (int i = 0; i < degree; ++i) {
       std::complex<N> P_x_i;
       polynomial_evaluate(P, x[i], P_x_i);
-      std::complex<N> d(N(1.0), N(0.0));
+      std::complex<N> d(N(1), N(0));
       for (int j = 0; j < degree; ++j)
         if (i != j)
           d *= (x[i] - x[j]);
@@ -167,10 +168,10 @@ bool test04() {
   // x^2 - 1
   P[1] = 0;
   P[0] = -1;
-  for (double d = 0.0; d <= 10.0; d += 1.0) {
+  for (int d = 0; d <= 10; ++d) {
     std::complex<N> P_x_i;
     polynomial_evaluate(P,
-                        std::complex<N>(N(d), N(0.0)),
+                        std::complex<N>(N(d), N(0)),
                         P_x_i);
     nout << d << " " << P_x_i << endl;
   }
diff --git a/tests/Box/membytes1.cc b/tests/Box/membytes1.cc
index 47d28a1..8a0093b 100644
--- a/tests/Box/membytes1.cc
+++ b/tests/Box/membytes1.cc
@@ -63,17 +63,21 @@ bool test02() {
 
   Pointset_Powerset<TBox> pbox(2, EMPTY);
   TBox box(2);
-  TBox::interval_type ix;
-  TBox::interval_type iy;
+
+  typedef TBox::interval_type interval_type;
+  typedef interval_type::boundary_type boundary_type;
+
+  interval_type ix;
+  interval_type iy;
 
   for (double d = -M_PI; d <= M_PI; d += 0.01) {
     ix.assign(EMPTY);
-    ix.join_assign(d-0.015);
-    ix.join_assign(d+0.015);
+    ix.join_assign(boundary_type(d-0.015));
+    ix.join_assign(boundary_type(d+0.015));
 
     iy.assign(EMPTY);
-    iy.join_assign(sin(d-0.015));
-    iy.join_assign(sin(d+0.015));
+    iy.join_assign(boundary_type(sin(d-0.015)));
+    iy.join_assign(boundary_type(sin(d+0.015)));
 
     box.set_interval(x, ix);
     box.set_interval(y, iy);




More information about the PPL-devel mailing list