From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
Cc: | Daniel Farina <daniel(at)heroku(dot)com>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Tom Duffey *EXTERN* <tduffey(at)trillitech(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] Floating point error |
Date: | 2013-03-05 14:32:41 |
Message-ID: | 51360209.1020807@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 05.03.2013 15:59, Kevin Grittner wrote:
> Daniel Farina<daniel(at)heroku(dot)com> wrote:
>
>> This kind of change may have many practical problems that may
>> make it un-pragmatic to alter at this time (considering the
>> workaround is to set the extra float digits), but I can't quite
>> grasp the rationale for "well, the only program that cares about
>> the most precision available is pg_dump". It seems like most
>> programs would care just as much.
>
> Something to keep in mind is that when you store 0.01 into a double
> precision column, the precise value stored, when written in
> decimal, is:
>
> 0.01000000000000000020816681711721685132943093776702880859375
>
> Of course, some values can't be precisely written in decimal with
> so few digits.
It would be nice to have a base-2 text format to represent floats. It
wouldn't be as human-friendly as base-10, but it could be used when you
don't want to lose precision. pg_dump in particular.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Shaun Thomas | 2013-03-05 14:51:11 | Why does slony use a cursor? Anyone know? |
Previous Message | Adrian Klaver | 2013-03-05 14:26:46 | Re: 9.2 timestamp function syntax error |
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2013-03-05 14:44:38 | Re: Materialized views WIP patch |
Previous Message | Fujii Masao | 2013-03-05 14:22:14 | Re: Support for REINDEX CONCURRENTLY |