Jeff Davis <[email protected]> wrote:

> I saw some strange results:
>
> postgres=# select '1.1'::numeric = '1.1'::float8;
> ?column?
> ----------
> t
> (1 row)
>
> postgres=# select '1.1'::numeric = '1.1'::float4;
> ?column?
> ----------
> f
> (1 row)

The part I find strange is that the first one evaluates to true,
since numeric can exactly represent 1.1 and float8 cannot.  It also
seems inconsistent with this:

test=# set extra_float_digits = 3;
SET
test=# select '1.1'::float4;
   float4
------------
 1.10000002
(1 row)

test=# select '1.1'::float8;
       float8
---------------------
 1.10000000000000009
(1 row)

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to