[PPL-devel] [GIT] ppl/ppl(floating_point): linearize.hh:
Fabio Bossi
bossi at cs.unipr.it
Mon Jul 26 15:46:50 CEST 2010
Module: ppl/ppl
Branch: floating_point
Commit: 77104a92691b2a793fa6e522f7f3d959b594417c
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=77104a92691b2a793fa6e522f7f3d959b594417c
Author: Fabio Bossi <bossi at cs.unipr.it>
Date: Mon Jul 26 15:45:20 2010 +0200
linearize.hh:
- Fixed mistake when accessing type informations.
C_Expr:
- Small progress in the implementation.
---
src/linearize.hh | 12 ++++++++----
tests/Concrete_Expression/C_Expr.defs.hh | 27 +++++++++++++++++++++++++++
tests/Concrete_Expression/C_Expr.inlines.hh | 27 +++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/src/linearize.hh b/src/linearize.hh
index 7883cfa..3bc8f2f 100644
--- a/src/linearize.hh
+++ b/src/linearize.hh
@@ -117,7 +117,8 @@ add_linearize(const Binary_Operator<Target>& bop_expr,
if (!linearize(*(bop_expr.left_hand_side()), int_store, lf_store, result))
return false;
- Floating_Point_Format analyzed_format = bop_expr.floating_point_format();
+ Floating_Point_Format analyzed_format =
+ bop_expr.type().floating_point_format();
FP_Linear_Form rel_error;
result.relative_error(analyzed_format, rel_error);
result += rel_error;
@@ -227,7 +228,8 @@ sub_linearize(const Binary_Operator<Target>& bop_expr,
if (!linearize(*(bop_expr.left_hand_side()), int_store, lf_store, result))
return false;
- Floating_Point_Format analyzed_format = bop_expr.floating_point_format();
+ Floating_Point_Format analyzed_format =
+ bop_expr.type().floating_point_format();
FP_Linear_Form rel_error;
result.relative_error(analyzed_format, rel_error);
result += rel_error;
@@ -415,7 +417,8 @@ mul_linearize(const Binary_Operator<Target>& bop_expr,
// Here we do the actual computation.
// For optimizing, we store the relative error directly into result.
- Floating_Point_Format analyzed_format = bop_expr.floating_point_format();
+ Floating_Point_Format analyzed_format =
+ bop_expr.type().floating_point_format();
if (intervalize_first) {
linearized_second_operand.relative_error(analyzed_format, result);
linearized_second_operand *= intervalized_first_operand;
@@ -558,7 +561,8 @@ div_linearize(const Binary_Operator<Target>& bop_expr,
if (!linearize(*(bop_expr.left_hand_side()), int_store, lf_store, result))
return false;
- Floating_Point_Format analyzed_format = bop_expr.floating_point_format();
+ Floating_Point_Format analyzed_format =
+ bop_expr.type().floating_point_format();
FP_Linear_Form rel_error;
result.relative_error(analyzed_format, rel_error);
result /= intervalized_second_operand;
diff --git a/tests/Concrete_Expression/C_Expr.defs.hh b/tests/Concrete_Expression/C_Expr.defs.hh
index 41c2053..073e9a8 100644
--- a/tests/Concrete_Expression/C_Expr.defs.hh
+++ b/tests/Concrete_Expression/C_Expr.defs.hh
@@ -141,6 +141,15 @@ template <>
class Cast_Operator<C_Expr>
: public Cast_Operator_Base<C_Expr> {
public:
+ //! Do-nothing destructor.
+ ~Cast_Operator<C_Expr>();
+
+ //! Returns the type of \p *this.
+ Concrete_Expression_Type type() const;
+
+ //! Returns the kind of \p *this.
+ Concrete_Expression_Kind kind() const;
+
//! Constant identifying cast nodes.
enum { KIND = 3 };
};
@@ -149,6 +158,15 @@ template <>
class Integer_Constant<C_Expr>
: public Integer_Constant_Base<C_Expr> {
public:
+ //! Do-nothing destructor.
+ ~Integer_Constant<C_Expr>();
+
+ //! Returns the type of \p *this.
+ Concrete_Expression_Type type() const;
+
+ //! Returns the kind of \p *this.
+ Concrete_Expression_Kind kind() const;
+
//! Constant identifying integer constant nodes.
enum { KIND = 4 };
};
@@ -157,6 +175,15 @@ template <>
class Floating_Point_Constant<C_Expr>
: public Floating_Point_Constant_Base<C_Expr> {
public:
+ //! Do-nothing destructor.
+ ~Floating_Point_Constant<C_Expr>();
+
+ //! Returns the type of \p *this.
+ Concrete_Expression_Type type() const;
+
+ //! Returns the kind of \p *this.
+ Concrete_Expression_Kind kind() const;
+
//! Constant identifying floating constant nodes.
enum { KIND = 5 };
};
diff --git a/tests/Concrete_Expression/C_Expr.inlines.hh b/tests/Concrete_Expression/C_Expr.inlines.hh
index 43acc0e..900e90f 100644
--- a/tests/Concrete_Expression/C_Expr.inlines.hh
+++ b/tests/Concrete_Expression/C_Expr.inlines.hh
@@ -87,6 +87,33 @@ Unary_Operator<C_Expr>::argument() const {
}
inline
+Cast_Operator<C_Expr>::~Cast_Operator<C_Expr>() {
+}
+
+inline Concrete_Expression_Kind
+Cast_Operator<C_Expr>::kind() const {
+ return KIND;
+}
+
+inline
+Integer_Constant<C_Expr>::~Integer_Constant<C_Expr>() {
+}
+
+inline Concrete_Expression_Kind
+Integer_Constant<C_Expr>::kind() const {
+ return KIND;
+}
+
+inline
+Floating_Point_Constant<C_Expr>::~Floating_Point_Constant<C_Expr>() {
+}
+
+inline Concrete_Expression_Kind
+Floating_Point_Constant<C_Expr>::kind() const {
+ return KIND;
+}
+
+inline
Approximable_Reference<C_Expr>::
Approximable_Reference(dimension_type var_index)
: var_dimension(var_index) {
More information about the PPL-devel
mailing list