Re: Modulus operator returns negative values / numeric

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: Paul Tillotson <pntil(at)shentel(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Modulus operator returns negative values / numeric
Date: 2005-05-26 15:42:01
Message-ID: 20050526154201.GE7589@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, May 26, 2005 at 08:56:34AM -0400, Paul Tillotson wrote:
> Tom Lane wrote:
>
> >Paul Tillotson <pntil(at)shentel(dot)net> writes:

> In other words, no arbitrary number of extra decimal places when calling
> div_var() will be always sufficient to prevent rounding up at some other
> decimal place.

No, an arbitrary number won't do. I found I could make it work by
adding as much extra decimals as digits in the divisor. At least it
worked for these test cases I made up. (Attached)

> >I cannot believe that that won't create problems at least as bad as it
> >solves. Have you even tried the regression tests on this?

> <sheepish grin> No. Can you tell me how to do that?

make installcheck in src/test/regress

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"Cómo ponemos nuestros dedos en la arcilla del otro. Eso es la amistad; jugar
al alfarero y ver qué formas se pueden sacar del otro" (C. Halloway en
La Feria de las Tinieblas, R. Bradbury)

Attachment Content-Type Size
mod_test2.sql text/plain 1.5 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Manuel García 2005-05-26 15:55:11 Can postgresql catch all the sentences applies to one table?
Previous Message Douglas McNaught 2005-05-26 15:18:48 Re: Query for importing and exporting data from a database