Re: [HACKERS] Float/Double cast to int

2015-05-21 Thread Michael Paquier
On Fri, May 22, 2015 at 4:33 AM, Feng Tian wrote: > Ah, thanks! I did not realize numeric comes into play. But, this is even > more interesting -- I would expect numeric is more consistent than > float/double when dealing with stuff like rounding. > > I missed the not too long ago discussion, :

Re: [HACKERS] Float/Double cast to int

2015-05-21 Thread Feng Tian
Ah, thanks! I did not realize numeric comes into play. But, this is even more interesting -- I would expect numeric is more consistent than float/double when dealing with stuff like rounding. I missed the not too long ago discussion, :-) Regardless of the mechanisms underneath, it would be qu

Re: [HACKERS] Float/Double cast to int

2015-05-21 Thread Tom Lane
Feng Tian writes: > Here is a query, server was built witch GCC on Linux, AMD64. > ftian=# select 1.5::int, 1.5::double precision::int, 314.5::int, > 314.5::double precision::int; > int4 | int4 | int4 | int4 > --+--+--+-- > 2 |2 | 315 | 314 > (1 row) > I believe this i

[HACKERS] Float/Double cast to int

2015-05-21 Thread Feng Tian
Hi, Hackers, Here is a query, server was built witch GCC on Linux, AMD64. ftian=# ftian=# select 1.5::int, 1.5::double precision::int, 314.5::int, 314.5::double precision::int; int4 | int4 | int4 | int4 --+--+--+-- 2 |2 | 315 | 314 (1 row) I believe this is because r