Re: bug in numeric log() on 7.1, 7.2.2, 7.2.3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dmarin <dmarin(at)uclink(dot)berkeley(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug in numeric log() on 7.1, 7.2.2, 7.2.3
Date: 2003-03-14 00:22:12
Message-ID: 12658.1047601332@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

dmarin <dmarin(at)uclink(dot)berkeley(dot)edu> writes:
> This query never returns:
> select log(93094::numeric/92908::numeric);

The attached patch against 7.3 seems to take care of the problem. You
should be able to apply it to 7.2, with possibly some tweaking (the code
needs to go into the loop in ln_var()).

I am unsure whether exp_var() needs a similar defense against roundoff
error. Have you observed any problems there?

*** src/backend/utils/adt/numeric.c.orig Tue Mar 11 16:01:33 2003
--- src/backend/utils/adt/numeric.c Thu Mar 13 19:06:42 2003
***************
*** 3872,3877 ****
--- 3872,3880 ----
break;

add_var(result, &elem, result);
+
+ if (elem.weight < (result->weight - 2 * global_rscale))
+ break;
}

/* Compensate for argument range reduction, round to caller's rscale */


> P.S. Incidentally, on the solaris system, I also can't use pg_dump at all; no
> matter what database I try to dump, I get a bus error:

> [dmarin(at)boojum]$ pg_dump template1;
> Bus Error

> Is this a known problem, or would you like more information?)

Which pg_dump version is this? Where is it crashing exactly (a stack
trace would help)?

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joshua Moore-Oliva 2003-03-14 03:08:44 Bug in AT TIME ZONE contruct between EST and INTERVAL '-05:00'
Previous Message Tom Lane 2003-03-13 23:06:11 Re: now() and date_trunc() apparently corrupting data