From: Inoue, Hiroshi <inoue@tpf.co.jp>
To: John Smith <nukemd@hotmail.com>
Cc: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Precision problems with storage of float/double
Date: Tue, 17 Jun 2014 12:24:51 +0900
Message-ID: <539FB503.3090103@tpf.co.jp> (raw)
In-Reply-To: <DUB121-W17AD73873B390AF3AEF384D3170@phx.gbl>
References: <DUB121-W17AD73873B390AF3AEF384D3170@phx.gbl>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
(2014/06/16 1:51), John Smith wrote:
> 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.
Thanks.
As far as I examined, 9 decimal digits for 32-bit reals and 17 decimal
digits for 64-bit doubles are sufficient to guarantee the complete
recovery.
Is it OK to change decimal digits in your patch to those ones?
Hmm I noticed that server's output should be changed in addition
to this change. The setting of extra_float_digits should be changed
from 2 to 3.
regards,
Hiroshi Inoue
--
I am using the free version of SPAMfighter.
SPAMfighter has removed 10915 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len
Do you have a slow PC? Try a Free scan
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: inoue@tpf.co.jp, nukemd@hotmail.com
Subject: Re: Precision problems with storage of float/double
In-Reply-To: <539FB503.3090103@tpf.co.jp>
References: <DUB121-W17AD73873B390AF3AEF384D3170@phx.gbl> <539FB503.3090103@tpf.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox