Re: Unexpected result using floor() function - Mailing list pgsql-general

From Chris Mair
Subject Re: Unexpected result using floor() function
Date
Msg-id 0330e2fc5115dab378d6282dc283b088@smtp.hushmail.com
Whole thread Raw
In response to Re: Unexpected result using floor() function  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Hi,

maybe this is a late reply, but also note that 4.725 alone already cannot be
represented in floating point exactly (and this has nothing to do with Postgres).

Just sum it up 100 times to "see" the round off error becoming visible:

chris=# select sum(4.725::double precision) from generate_series(1,100);
        sum
------------------
  472.500000000001
(1 row)

vs.

chris=# select sum(4.725::numeric) from generate_series(1,100);
    sum
---------
  472.500
(1 row)

Bye,
Chris.




pgsql-general by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: ON CONFLICT DO NOTHING RETURNING
Next
From: "drum.lucas@gmail.com"
Date:
Subject: Unique UUID value - PostgreSQL 9.2