[PPL-devel] [GIT] ppl/ppl(master): Improved Multiplication_Floating_Point_Expression:: linearize.
Roberto Amadini
r.amadini at virgilio.it
Mon Dec 28 20:28:25 CET 2009
Module: ppl/ppl
Branch: master
Commit: 7bfd19aec5b224dab0d853f4904f5118e8c77fde
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=7bfd19aec5b224dab0d853f4904f5118e8c77fde
Author: Roberto Amadini <r.amadini at virgilio.it>
Date: Mon Dec 28 14:21:22 2009 +0100
Improved Multiplication_Floating_Point_Expression::linearize.
---
...lication_Floating_Point_Expression.templates.hh | 33 ++++++++++++++------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/Multiplication_Floating_Point_Expression.templates.hh b/src/Multiplication_Floating_Point_Expression.templates.hh
index fdda55e..f1fc29f 100644
--- a/src/Multiplication_Floating_Point_Expression.templates.hh
+++ b/src/Multiplication_Floating_Point_Expression.templates.hh
@@ -55,19 +55,32 @@ void Multiplication_Floating_Point_Expression<FP_Interval_Type, FP_Format>
boundary_type first_interval_size, second_interval_size;
// FIXME: we are not sure that what we do here is policy-proof.
- if (intervalized_first_operand.is_bounded()
- && intervalized_second_operand.is_bounded()) {
- first_interval_size = intervalized_first_operand.upper()
- - intervalized_first_operand.lower();
- second_interval_size = intervalized_second_operand.upper()
- - intervalized_second_operand.lower();
- if (first_interval_size <= second_interval_size)
+ if (intervalized_first_operand.is_bounded()) {
+ if (intervalized_second_operand.is_bounded()) {
+ first_interval_size = intervalized_first_operand.upper() -
+ intervalized_first_operand.lower();
+ second_interval_size = intervalized_second_operand.upper() -
+ intervalized_second_operand.lower();
+ if (first_interval_size <= second_interval_size)
+ intervalize_first = true;
+ else
+ intervalize_first = false;
+ }
+ else {
+ if (this->overflows(linearized_second_operand))
+ throw Linearization_Failed();
intervalize_first = true;
- else
+ }
+ }
+ else {
+ if (intervalized_second_operand.is_bounded()) {
+ if (this->overflows(linearized_first_operand))
+ throw Linearization_Failed();
intervalize_first = false;
+ }
+ else
+ throw Linearization_Failed();
}
- else
- throw Linearization_Failed();
// Here we do the actual computation.
// For optimizing, we store the relative error directly into result.
More information about the PPL-devel
mailing list