From d6c537443dc5954ca21a849b45dc5adedca6211c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 28 Jan 2014 21:47:32 +0200 Subject: Fix bug that only showed up on 32 bit systems with MPFR. --- awkgram.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'awkgram.c') diff --git a/awkgram.c b/awkgram.c index 657a1627..58ac3480 100644 --- a/awkgram.c +++ b/awkgram.c @@ -4514,10 +4514,13 @@ negate_num(NODE *n) { int tval = 0; - if (! is_mpg_number(n)) + if (! is_mpg_number(n)) { n->numbr = -n->numbr; + return; + } + #ifdef HAVE_MPFR - else if (is_mpg_integer(n)) { + if (is_mpg_integer(n)) { if (! iszero(n)) { mpz_neg(n->mpg_i, n->mpg_i); return; @@ -4526,9 +4529,11 @@ negate_num(NODE *n) /* * 0 --> -0 conversion. Requires turning the MPG integer * into an MPFR float. - * - * So, convert and fall through. */ + + mpz_clear(n->mpg_i); /* release the integer storage */ + + /* Convert and fall through. */ tval = mpfr_set_d(n->mpg_numbr, 0.0, ROUND_MODE); IEEE_FMT(n->mpg_numbr, tval); n->flags &= ~MPZN; -- cgit v1.2.3