Re: Question about the TODO, numerics, and division

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Chris Travers" <chris(at)verkiel(dot)metatrontech(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about the TODO, numerics, and division
Date: 2007-03-21 12:58:31
Message-ID: 87fy7yhhxk.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> but I wouldn't want to defend the details of the rule about how many
> fractional digits out given so many fractional digits in.

In particular it seems to me this is poor:

postgres=# select 1::numeric/10;
?column?
------------------------
0.10000000000000000000
(1 row)

In an ideal world it seems to me that if you're dividing by a number with only
factors of 2 and 5 you should only gain as many digits as necessary to
represent the result exactly.

At the very least if you're dividing by a power of ten we should just move the
decimal place and keep the same overall precision.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-03-21 13:07:49 Re: GSoC's possible project
Previous Message Gregory Stark 2007-03-21 12:51:38 Re: patch adding new regexp functions