From: | Tom Duffey <tduffey(at)trillitech(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Floating point error |
Date: | 2013-02-25 02:13:20 |
Message-ID: | F0E0F874-C86F-48D1-AA2A-0C5365BF5118@trillitech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hi Everyone,
Riddle me this. I have a database column of type "real" that gets mapped to a Java field of type double via JDBC. We have two databases, test and production, and the test database is periodically blown away and reloaded from a copy of production. We recently noticed that some values do not match when viewed within our application on test vs. production. More specifically:
- Selecting values from both test and production DBs using psql shows "10.3885" as the value
- The Java app on production shows "10.3884573" while the test app shows "10.3885"
I have a hunch that when the value was originally inserted into the production DB it probably contained more than the 6 digits supported by the real data type. It may have even been exactly the "10.3884573" value we see when retrieving via JDBC on production. What I don't understand is why when the value gets mapped back to Java via JDBC those extra digits are coming back. Can anyone explain this or do you think I'm on the wrong track? I stepped through code and it sure seems like the extra information is coming back from the JDBC driver.
Tom
--
Tom Duffey
tduffey(at)trillitech(dot)com
414-751-0600 x102
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2013-02-25 02:20:11 | Re: Floating point error |
Previous Message | Maz Mohammadi | 2013-02-25 01:54:44 | Re: [JDBC] can't access through SSL |
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2013-02-25 02:20:11 | Re: Floating point error |
Previous Message | Craig Ringer | 2013-02-25 01:13:13 | Re: Show type in psql SELECT |