Try this:
create table test (f float);
insert into test values (330.0);
commit;
select (8 + 330.0/60)::int; --14
select (8 + f/60)::int from test; --14
select (9 + 330.0/60)::int; --15
select (9 + f/60)::int from test; --14
Can someone explain why the last query returns 14 instead of 15?
PostgreSQL 9.3.9 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
12.04.5 LTS (GNU/Linux 3.2.0-63-virtual x86_64)
Asked by kev
(397 rep)
Sep 1, 2014, 06:05 AM
Last activity: Jun 26, 2015, 06:32 AM
Last activity: Jun 26, 2015, 06:32 AM