Re: float8 auto truncation issue in ODBC v. PGSQL - Mailing list pgsql-odbc

From Tom Lane
Subject Re: float8 auto truncation issue in ODBC v. PGSQL
Date
Msg-id 10152.1150229689@sss.pgh.pa.us
Whole thread Raw
In response to float8 auto truncation issue in ODBC v. PGSQL  (postgresql.org@tgice.com)
Responses Re: float8 auto truncation issue in ODBC v. PGSQL  ("Campbell, Greg" <greg.campbell@us.michelin.com>)
Re: float8 auto truncation issue in ODBC v. PGSQL  (postgresql.org@tgice.com)
List pgsql-odbc
postgresql.org@tgice.com writes:
> When I use my own ODBC SQL client to select the same value from my
> Postgres 8.0 database, I get the same thing:
>    1.0475000000000001

> *However*, and here's the troubling part, when I select the exact same
> value using psql (and I have reason to believe the same thing is going
> on inside pl/pgsql functions), the value that comes out is:
>    1.0475

By default, the float8 output routine prints a digit or so less than it
could, precisely to avoid that sort of unsightly result.  You can fool
with float_extra_digits (I think that's the right name, check the docs)
if you need to adjust this behavior.

This would only matter within a plpgsql function if you are doing
something that forces the binary value to be converted to text.  Which,
if you're doing tense float computation, you probably don't want to have
happen at all.

            regards, tom lane

pgsql-odbc by date:

Previous
From: postgresql.org@tgice.com
Date:
Subject: float8 auto truncation issue in ODBC v. PGSQL
Next
From: "Campbell, Greg"
Date:
Subject: Re: float8 auto truncation issue in ODBC v. PGSQL