[PPL-devel] [GIT] ppl/ppl(floating_point): Added one test.

Roberto Amadini r.amadini at virgilio.it
Mon Sep 7 18:12:00 CEST 2009


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

Author: Roberto Amadini <r.amadini at virgilio.it>
Date:   Mon Sep  7 18:03:22 2009 +0200

Added one test.

---

 .../floatingpointexpr1.cc                          |   34 ++++++++++++++++++-
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/tests/Floating_Point_Expression/floatingpointexpr1.cc b/tests/Floating_Point_Expression/floatingpointexpr1.cc
index c9a64d8..334eaa5 100644
--- a/tests/Floating_Point_Expression/floatingpointexpr1.cc
+++ b/tests/Floating_Point_Expression/floatingpointexpr1.cc
@@ -128,7 +128,8 @@ test04() {
   fl_r_oc kr(-std::numeric_limits<float>::denorm_min());
   kr.join_assign(std::numeric_limits<float>::denorm_min());
   Float_Interval_Linear_Form known_result(kr);
-  nout << known_result << endl;
+  nout << "*** known_result ***" << endl
+       << known_result << endl;
   return result == known_result;
 }
 
@@ -148,7 +149,35 @@ test05() {
   db_r_oc kr(-std::numeric_limits<double>::denorm_min());
   kr.join_assign(std::numeric_limits<double>::denorm_min());
   Double_Interval_Linear_Form known_result(kr);
-  nout << known_result << endl;
+  nout << "*** known_result ***" << endl
+       << known_result << endl;
+  return result == known_result;
+}
+
+bool
+test06() {
+  sstr store;
+  fl_r_oc tmp = fl_r_oc(0);
+  tmp.join_assign(1);
+  store[0] = tmp;
+  store[1] = fl_r_oc(2);
+  var_fpess* var0 = new var_fpess(0);
+  var_fpess* var1 = new var_fpess(1);
+  mul_fpess mul(var0, var1);
+  Float_Interval_Linear_Form result;
+  mul.linearize(store, result);
+  tmp = fl_r_oc(-std::numeric_limits<float>::denorm_min());
+  tmp.join_assign(std::numeric_limits<float>::denorm_min());
+  float exp = pow(2, -22);
+  fl_r_oc coeff = fl_r_oc(-exp);
+  coeff.join_assign(exp);
+  coeff += fl_r_oc(2);
+  Float_Interval_Linear_Form known_result =
+  Float_Interval_Linear_Form(Variable(0));
+  known_result *= coeff;
+  known_result += tmp;
+  nout << "*** known_result ***" << endl
+       << known_result << endl;
   return result == known_result;
 }
 
@@ -160,4 +189,5 @@ BEGIN_MAIN
   DO_TEST(test03);
   DO_TEST(test04);
   DO_TEST(test05);
+  DO_TEST(test06);
 END_MAIN




More information about the PPL-devel mailing list