[PPL-devel] [GIT] ppl/ppl(floating_point): Added a workaround for the fact that we don' t have an explicit way to

Fabio Bossi bossi at cs.unipr.it
Fri Sep 4 11:13:41 CEST 2009


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

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Fri Sep  4 11:16:05 2009 +0200

Added a workaround for the fact that we don't have an explicit way to
divide a Linear_Form by an Interval.

---

 ...Division_Floating_Point_Expression.templates.hh |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/Division_Floating_Point_Expression.templates.hh b/src/Division_Floating_Point_Expression.templates.hh
index 5fcfab9..ca464f0 100644
--- a/src/Division_Floating_Point_Expression.templates.hh
+++ b/src/Division_Floating_Point_Expression.templates.hh
@@ -43,10 +43,16 @@ typename Division_Floating_Point_Expression<FP_Interval_Type, FP_Format>
   FP_Interval_Type abs_error(-this->absolute_error);
   // FIXME: this may be incorrect for some policies.
   abs_error.join_assign(this->absolute_error);
-  FP_Linear_Form result = linearized_first_operand / intervalized_second_operand
-    + relative_error(linearized_first_operand) / intervalized_second_operand
-    + abs_error;
-
+  /*
+    FIXME: since we currently lack an explicit way to divide a linear form
+    by a scalar, we temporarily multiply by 1/scalar.
+  */
+  FP_Interval_Type reversed_intervalized_second_operand =
+     (FP_Interval_Type(boundary_type(1)) / intervalized_second_operand);
+  FP_Linear_Form result = linearized_first_operand *
+                          reversed_intervalized_second_operand +
+                          relative_error(linearized_first_operand) * 
+                          reversed_intervalized_second_operand + abs_error;
   return result;
 }
 




More information about the PPL-devel mailing list