Search Postgresql Archives

Re: Floating point error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/24/2013 6:20 PM, John R Pierce wrote:
On 2/24/2013 6:13 PM, Tom Duffey wrote:
- The Java app on production shows "10.3884573" while the test app shows "10.3885"

'real' is single precision, which is only about 6 digits of decimal accuracy. if your java variables were double precision, you probably should have used double in postgres too.

0.1 decimal is a repeating fraction in binary.

ooops, missed my third point. if precise decimal numbers are important, use a decimal data type, which is NUMERIC in SQL (I'm not familiar enough with Java to know if it has a BCD or other decimal type).

--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux