Re: Numeric modulo operator is incorrect.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ken-ichi Yamasaki <yama(at)yuzu(dot)gr(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Numeric modulo operator is incorrect.
Date: 2001-04-13 19:54:46
Message-ID: 7162.987191686@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ken-ichi Yamasaki <yama(at)yuzu(dot)gr(dot)jp> writes:
> I build PostgreSQL 7.0.3 with jumbo-20010318.patch.gz on Vine Linux2.1.5.

> Following result are incorrect. Am I under an illusion?

> test=# select '34666624082'::numeric % '34666671'::numeric;
> ?column?
> ----------
> -46918
> (1 row)

This is a bug; looks like mod_var() is using a rather silly estimate
of how many digits of precision it needs to keep in the division step.

I have a fix but I'm not sure if it will get into 7.1 or be held
for 7.1.1 ...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message rpijlman 2001-04-13 22:40:56 Error on reference to inherited primary key
Previous Message Tom Lane 2001-04-13 17:20:31 Re: aliasing table name in update