Bug fix: prevent negative zero.
authormdw <mdw>
Tue, 15 Oct 2002 22:57:43 +0000 (22:57 +0000)
committermdw <mdw>
Tue, 15 Oct 2002 22:57:43 +0000 (22:57 +0000)
mptext.c
tests/mptext

index 40e1764..fcdac51 100644 (file)
--- a/mptext.c
+++ b/mptext.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mptext.c,v 1.15 2002/10/15 19:18:15 mdw Exp $
+ * $Id: mptext.c,v 1.16 2002/10/15 22:57:43 mdw Exp $
  *
  * Textual representation of multiprecision numbers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mptext.c,v $
+ * Revision 1.16  2002/10/15 22:57:43  mdw
+ * Bug fix: prevent negative zero.
+ *
  * Revision 1.15  2002/10/15 19:18:15  mdw
  * Fix fencepost bugs in binary radix writing.
  *
@@ -501,6 +504,7 @@ done:
 
   if (f & f_neg)
     m->f |= MP_NEG;
+  MP_SHRINK(m);
   return (m);
 
 #undef f_start
index db6ed83..71acb86 100644 (file)
@@ -1,6 +1,6 @@
 # Test vectors for MP textual I/O
 #
-# $Id: mptext,v 1.10 2002/10/15 19:18:15 mdw Exp $
+# $Id: mptext,v 1.11 2002/10/15 22:57:43 mdw Exp $
 
 mptext-ascii {
   # --- Perfectly valid things ---
@@ -60,6 +60,10 @@ mptext-ascii {
 
   10 -4009356060                       16 -eef9eb1c;
 
+  # --- Cussidness ---
+
+  0 -0                                 10 0;
+
   # --- Bugs ---
 
   16 84d192cd06ae59691897fa409da6198d5269325d