[PPL-devel] [GIT] ppl/ppl(sparse_matrices): Improved documentation for number input routine.

Enea Zaffanella zaffanella at cs.unipr.it
Fri Sep 3 14:36:11 CEST 2010


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Wed Sep  1 08:36:00 2010 +0200

Improved documentation for number input routine.
Added another couple of tests.

---

 src/Checked_Number.defs.hh       |    4 ++++
 tests/Polyhedron/numberinput1.cc |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/Checked_Number.defs.hh b/src/Checked_Number.defs.hh
index 5bef261..8807f59 100644
--- a/src/Checked_Number.defs.hh
+++ b/src/Checked_Number.defs.hh
@@ -926,6 +926,10 @@ ascii_dump(std::ostream& s, const T& t);
     <CODE>16^^1*^2</CODE> (meaning \f$256\f$);
   - the C-style hexadecimal prefix <CODE>0x</CODE> is interpreted as
     the Mathematica-style prefix <CODE>16^^</CODE>;
+  - the C-style binary exponent indicator <CODE>p</CODE> can only be used
+    when base 16 has been specified; if used, the exponent will be
+    applied to base 2 (instead of base 16, as is the case when the
+    indicator <CODE>e</CODE> is used);
   - special values like <CODE>inf</CODE> and <CODE>+inf</CODE>
     (meaning \f$+\infty\f$), <CODE>-inf</CODE> (meaning \f$-\infty\f$),
     and <CODE>nan</CODE> (meaning "not a number").
diff --git a/tests/Polyhedron/numberinput1.cc b/tests/Polyhedron/numberinput1.cc
index cfb33e2..f4069c3 100644
--- a/tests/Polyhedron/numberinput1.cc
+++ b/tests/Polyhedron/numberinput1.cc
@@ -146,6 +146,8 @@ test04() {
     && aux_test("0.123456     ", "1929/15625", "     ", V_EQ)
     && aux_test(".499975", "19999/40000", "", V_EQ)
     && aux_test(".333", "333/1000", "", V_EQ)
+    && aux_test("+.333", "333/1000", "", V_EQ)
+    && aux_test("-.333", "-333/1000", "", V_EQ)
     && aux_test(".0x333", "0", "x333", V_EQ);
 }
 
@@ -195,7 +197,10 @@ test07() {
     && aux_test("0x0.f", "15/16", "", V_EQ)
     && aux_test("0x.f", "15/16", "", V_EQ)
     && aux_test("0x.fp3", "15/2", "", V_EQ)
+    && aux_test("16^^.fp3", "15/2", "", V_EQ)
     && aux_test("0x100p-9", "1/2", "", V_EQ)
+    && aux_test("16^^100p-9", "1/2", "", V_EQ)
+    && aux_test("100p-9", "nan", "p-9", V_CVT_STR_UNK)
     && aux_test("0x.f*^1", "15", "", V_EQ)
     && aux_test("0x-f", "nan", "-f", V_CVT_STR_UNK)
     && aux_test("0xfa", "250", "", V_EQ)




More information about the PPL-devel mailing list