Alban Hertroys <haramrae(at)gmail(dot)com> writes:
> On 11 Oct 2011, at 2:55, Harvey, Allan AC wrote:
>> My simple understanding of trunc() and casting to an integer says that
>> there is a bug here.
> Which the type-cast should round to 4380103 and 4380104 respectively.
> It doesn't:
That's because a cast from float to int rounds, it doesn't truncate.
regression=# select (4.7::float8)::int;
int4
------
5
(1 row)
regards, tom lane