From: Marc Herbert <Marc.Herbert@continuent.com>
To: pgsql-odbc@postgresql.org
Subject: Re: float8 auto truncation issue in ODBC v. PGSQL
Date: Wed, 14 Jun 2006 20:44:24 +0200
Message-ID: <khj1wtrtw53.fsf@meije.emic.fr> (raw)
References: <448F11E2.1020504@tgice.com>
<10152.1150229689@sss.pgh.pa.us>
<448F27E6.406@us.michelin.com>
"Campbell, Greg" <greg.campbell@us.michelin.com> writes:
> I've disassociated floats and exactness, that is floating point
> representations and exact matches do not seem to go together.
The issue is that "float" types actually means fractions encoded in
base 2 for efficiency reasons. Almost every time you go back and forth
between base 2 and base 10 you have to round, there is no exact
mapping between those two spaces.
For instance you can not write 1/3 (one third) in base 10 whereas you
can in base 3 using just a couple of digits (it's just "0.1")
> The idea was made more profound when I started looking into the
> multitude of options in representing a float in 16, 32 or 64
> bits. There are so many different ways to allocate bits for the
> number, and bits for the exponent, leading to radically different
> precisions.
Actually on today's hardware I thought it was hard to find anything
else than IEEE754 32 and 64 bits floats, standardized across all
platforms, and 32 bits values being a subset of 64 bits. So that does
not look like "many different ways" to me. Could you detail?
> Between a value
> on the server and a value on the client a difference out in the 15th
> decimal place hardly seems surprising.
Whether conversions and roundings happen on the server on or the
client does not seem to change the problem much IMHO.
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: Marc.Herbert@continuent.com
Subject: Re: float8 auto truncation issue in ODBC v. PGSQL
In-Reply-To: <khj1wtrtw53.fsf@meije.emic.fr>
References: <448F11E2.1020504@tgice.com> <10152.1150229689@sss.pgh.pa.us> <448F27E6.406@us.michelin.com> <khj1wtrtw53.fsf@meije.emic.fr>
* 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