From: | John Smith <nukemd(at)hotmail(dot)com> |
---|---|
To: | "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Precision problems with storage of float/double |
Date: | 2014-06-15 16:51:32 |
Message-ID: | DUB121-W17AD73873B390AF3AEF384D3170@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Hi,
I have found that floats and doubles that I save to the database with the ODBC driver may lose precision. The exact bit pattern of my double/float is not what is actually saved in the database. This causes difficulties in situations where you need to compare current record contents with the actual data that was inserted.
It appears to be related to conversion from the double/float to text before it is sent to the database.
I made a simple patch that appears to fix the issue (by adding more decimal digits in the string conversion), and a test case that tests the issue.
Attachment | Content-Type | Size |
---|---|---|
float-save.patch | application/octet-stream | 638 bytes |
float-save-test.c | text/plain | 2.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2014-06-16 04:13:30 | Re: Building psqlODBC installers |
Previous Message | John Smith | 2014-06-14 22:20:25 | Re: SQL_DATA_AT_EXEC fails for SQL_C_BIGINT and SQL_C_NUMERIC |