From: mdw Date: Tue, 15 Oct 2002 22:57:43 +0000 (+0000) Subject: Bug fix: prevent negative zero. X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/commitdiff_plain/9bca44cb97d2b5d01f41163932b260ae3a900299 Bug fix: prevent negative zero. --- diff --git a/mptext.c b/mptext.c index 40e1764..fcdac51 100644 --- 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 diff --git a/tests/mptext b/tests/mptext index db6ed83..71acb86 100644 --- a/tests/mptext +++ b/tests/mptext @@ -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