Skip site navigation (1) Skip section navigation (2)

Re: BUG in postgres mathematic

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: Max Vaschenko <max(at)nino(dot)ru>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG in postgres mathematic
Date: 2001-01-26 03:52:30
Message-ID: 28460.980481150@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Robert B. Easter" <reaster(at)comptechnews(dot)com> writes:
> This problem is not specific to Postgres.

The fact that 5*27.81*100 != 27.81*100*5 is certainly a garden-variety
floating-point roundoff error.  However, I think Max has a fair
complaint here: it seems float-to-int8 conversion is truncating, not
rounding like the other conversions to integer do.

regression=# select 4.7::float8::int4;
 ?column?
----------
        5
(1 row)

regression=# select 4.7::float8::int8;
 ?column?
----------
        4
(1 row)

Seems to me this is a bug we should fix.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-01-26 05:15:18
Subject: Re: select fails on indexed varchars.
Previous:From: Tom LaneDate: 2001-01-26 03:45:44
Subject: Re: large objects overwriting bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group