[PPL-devel] [GIT] ppl/ppl(floating_point): Added missing static casts so that tests now pass again.
Fabio Bossi
bossi at cs.unipr.it
Tue Sep 22 15:52:07 CEST 2009
Module: ppl/ppl
Branch: floating_point
Commit: d8e7d618dd4a429e1f9b80aacf5c4477d9f5aca3
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=d8e7d618dd4a429e1f9b80aacf5c4477d9f5aca3
Author: Fabio Bossi <bossi at cs.unipr.it>
Date: Tue Sep 22 15:54:49 2009 +0200
Added missing static casts so that tests now pass again.
---
src/Floating_Point_Expression.defs.hh | 2 +-
src/Floating_Point_Expression.templates.hh | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/Floating_Point_Expression.defs.hh b/src/Floating_Point_Expression.defs.hh
index f0cd9c5..effb30d 100644
--- a/src/Floating_Point_Expression.defs.hh
+++ b/src/Floating_Point_Expression.defs.hh
@@ -193,7 +193,7 @@ typename Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type
Floating_Point_Expression<FP_Interval_Type, FP_Format>::absolute_error =
std::max(static_cast<typename Floating_Point_Expression<FP_Interval_Type,
FP_Format>::boundary_type>
- (pow(2, 1 - FP_Format::EXPONENT_BIAS - FP_Format::MANTISSA_BITS)),
+ (pow(2, static_cast<typename Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type>(1) - FP_Format::EXPONENT_BIAS - FP_Format::MANTISSA_BITS)),
std::numeric_limits<typename Floating_Point_Expression<FP_Interval_Type,
FP_Format>
::boundary_type>::denorm_min());
diff --git a/src/Floating_Point_Expression.templates.hh b/src/Floating_Point_Expression.templates.hh
index 17e796d..0343bff 100644
--- a/src/Floating_Point_Expression.templates.hh
+++ b/src/Floating_Point_Expression.templates.hh
@@ -35,10 +35,9 @@ Floating_Point_Expression<FP_Interval_Type, FP_Format>
::relative_error(const FP_Linear_Form& lf, FP_Linear_Form& result) {
/* FIXME: here we assume that boundary_type can represent
(2)^(-FP_Format::MANTISSA_BITS) precisely. */
- FP_Interval_Type error_propagator(-pow(2, -FP_Format::MANTISSA_BITS));
+ FP_Interval_Type error_propagator(-pow(2, -static_cast<typename Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type>(FP_Format::MANTISSA_BITS)));
// FIXME: this may be incorrect for some policies.
- error_propagator.join_assign(FP_Interval_Type(
- pow(2, -FP_Format::MANTISSA_BITS)));
+ error_propagator.join_assign(FP_Interval_Type(pow(2, -static_cast<typename Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type>(FP_Format::MANTISSA_BITS))));
// Handle the inhomogeneous term.
const FP_Interval_Type* current_term = &lf.inhomogeneous_term();
More information about the PPL-devel
mailing list