[PPL-devel] [GIT] ppl/ppl(floating_point): Forgot to pass the common denominator to bounded_affine_image.

Fabio Bossi bossi at cs.unipr.it
Thu Sep 24 14:45:05 CEST 2009


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

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Thu Sep 24 14:44:33 2009 +0200

Forgot to pass the common denominator to bounded_affine_image.

---

 src/Polyhedron.defs.hh      |    9 +++++++--
 src/Polyhedron.templates.hh |   10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/Polyhedron.defs.hh b/src/Polyhedron.defs.hh
index 41c8ae6..74eeb78 100644
--- a/src/Polyhedron.defs.hh
+++ b/src/Polyhedron.defs.hh
@@ -2682,7 +2682,7 @@ protected:
     Used to store the result.
 
     This function ignores the upper bound of intervals in \p lf,
-    so that in fact the result can be seen as \p lf multiplied by a proper
+    so that in fact \p result can be seen as \p lf multiplied by a proper
     normalization constant.
   */
   template <typename FP_Format, typename Interval_Info>
@@ -2710,6 +2710,10 @@ protected:
     \param res_hi_coeff
     Stores the higher boundary of the inhomogeneous term of the result.
 
+    \param denominator
+    Becomes the common denominator of \p res_low_coeff, \p res_hi_coeff
+    and all coefficients in \p res.
+
     Results are obtained by normalizing denominators in \p lf, ignoring
     the upper bounds of variable coefficients in \p lf.
   */
@@ -2717,7 +2721,8 @@ protected:
   static void convert_to_integer_expressions(
 	      const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
               const dimension_type lf_dimension, Linear_Expression& res,
-              Coefficient& res_low_coeff, Coefficient& res_hi_coeff);
+              Coefficient& res_low_coeff, Coefficient& res_hi_coeff,
+              Coefficient& denominator);
 
 };
 
diff --git a/src/Polyhedron.templates.hh b/src/Polyhedron.templates.hh
index 491bb20..51af2b5 100644
--- a/src/Polyhedron.templates.hh
+++ b/src/Polyhedron.templates.hh
@@ -379,11 +379,13 @@ const Box< Interval<FP_Format, Interval_Info> >& store) {
   Linear_Expression lf_approx_le;
   PPL_DIRTY_TEMP_COEFFICIENT(lo_coeff);
   PPL_DIRTY_TEMP_COEFFICIENT(hi_coeff);
+  PPL_DIRTY_TEMP_COEFFICIENT(denominator);
   convert_to_integer_expressions(lf_approx, lf_space_dim, lf_approx_le,
-                                 lo_coeff, hi_coeff);
+                                 lo_coeff, hi_coeff, denominator);
 
   // Finally, do the assignment.
-  bounded_affine_image(var, lf_approx_le + lo_coeff, lf_approx_le + hi_coeff);
+  bounded_affine_image(var, lf_approx_le + lo_coeff, lf_approx_le + hi_coeff,
+                       denominator);
 }
 
 template <typename FP_Format, typename Interval_Info>
@@ -482,7 +484,8 @@ void
 Polyhedron::convert_to_integer_expressions(
 	        const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
                 const dimension_type lf_dimension, Linear_Expression& res,
-                Coefficient& res_low_coeff, Coefficient& res_hi_coeff) {
+                Coefficient& res_low_coeff, Coefficient& res_hi_coeff,
+                Coefficient& lcm) {
   res = Linear_Expression();
 
   typedef Interval<FP_Format, Interval_Info> FP_Interval_Type;
@@ -491,7 +494,6 @@ Polyhedron::convert_to_integer_expressions(
 
   // Convert each floating point number to a pair <numerator, denominator>
   // and compute the lcm of all denominators.
-  PPL_DIRTY_TEMP_COEFFICIENT(lcm);
   lcm = 1;
   const FP_Interval_Type& b = lf.inhomogeneous_term();
   numer_denom(b.lower(), numerators[lf_dimension], denominators[lf_dimension]);




More information about the PPL-devel mailing list