Re: [GENERAL] Floating point error

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Daniel Farina <daniel(at)heroku(dot)com>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Cc: 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 13:59:26
Message-ID: 1362491966.28424.YahooMailNeo@web162904.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2013-03-05 14:26:46 Re: 9.2 timestamp function syntax error
Previous Message Alexander Farber 2013-03-05 09:59:09 Re: Finding matching words in a word game

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-03-05 14:02:05 Re: Suggested new CF status: "Pending Discussion"
Previous Message Pavel Stehule 2013-03-05 13:46:37 Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used