Re: float8 transmitted in ascii - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: float8 transmitted in ascii
Date
Msg-id 35729.1430351992@sss.pgh.pa.us
Whole thread Raw
In response to Re: float8 transmitted in ascii  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: float8 transmitted in ascii  (Timo Nentwig <postgres@nentwig.biz>)
List pgsql-jdbc
Dave Cramer <pg@fastcrypt.com> writes:
> If I understand you correctly in java you did:
> select 47.88::DOUBLE PRECISION,
> (47.88::DOUBLE PRECISION)::text,
> (47.88::DOUBLE PRECISION)::numeric,
> replace((47.88::DOUBLE PRECISION)::text, '.', ',');
> and the two numeric values are correct, but the text values are wrong ?

extra_float_digits explains it all, I'm sure.

regression=# select 47.88::DOUBLE PRECISION,
(47.88::DOUBLE PRECISION)::text,
(47.88::DOUBLE PRECISION)::numeric,
replace((47.88::DOUBLE PRECISION)::text, '.', ',');
 float8 | text  | numeric | replace
--------+-------+---------+---------
  47.88 | 47.88 |   47.88 | 47,88
(1 row)

regression=# set extra_float_digits = 3;
SET
regression=# select 47.88::DOUBLE PRECISION,
(47.88::DOUBLE PRECISION)::text,
(47.88::DOUBLE PRECISION)::numeric,
replace((47.88::DOUBLE PRECISION)::text, '.', ',');
       float8        |        text         | numeric |       replace
---------------------+---------------------+---------+---------------------
 47.8800000000000026 | 47.8800000000000026 |   47.88 | 47,8800000000000026
(1 row)


            regards, tom lane


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: float8 transmitted in ascii
Next
From: Timo Nentwig
Date:
Subject: Re: float8 transmitted in ascii