Re: WIP: rewrite numeric division - Mailing list pgsql-patches

From Tom Lane
Subject Re: WIP: rewrite numeric division
Date
Msg-id 24585.1184688004@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP: rewrite numeric division  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: WIP: rewrite numeric division
List pgsql-patches
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> Yeah.  I was basically waiting to see if anyone could come up with a
>> faster solution.  Since no one seems to have an idea how to do it
>> better, I'm inclined to apply the patch for 8.3.

> My only reservation is that I don't have the numeric methods background to
> tell if it's really necessary. My fix does resolve the only actual documented
> inaccuracy in the existing method.

Well, this doesn't take a lot of numerical methods background: the
fundamental problem is that the existing code generates an *approximate*
answer, whereas people who are doing div and mod on large integers tend
to expect an *exact* answer.  Approximate doesn't cut it --- there will
always be cases where an off-by-one-in-the-last-internal-place error can
carry far enough to the left to be visible to the user.

            regards, tom lane

pgsql-patches by date:

Previous
From: Gregory Stark
Date:
Subject: Re: WIP: rewrite numeric division
Next
From: "Affan Salman"
Date:
Subject: Re: Deferred RI trigger for non-key UPDATEs and subxacts