Subject | Re: The integer part of a number |
---|---|
Author | mauriciobornacin |
Post date | 2006-12-03T00:09:21Z |
Can anybody explain why
select cast(((24/60) + 0.495)as integer ) from table;
equals 0 and
select cast(((24/60) + 0.5)as integer ) from table;
equals 1
I'm trying to round on minutes and make a phone rate calculation
--- In firebird-support@yahoogroups.com, Milan Babuskov <milanb@...>
wrote:
select cast(((24/60) + 0.495)as integer ) from table;
equals 0 and
select cast(((24/60) + 0.5)as integer ) from table;
equals 1
I'm trying to round on minutes and make a phone rate calculation
--- In firebird-support@yahoogroups.com, Milan Babuskov <milanb@...>
wrote:
>besides
> Alexandre Benson Smith wrote:
> > But when I was replying I saw he wants just the integer part
> > rounding, then I will suggest an UDF.different way
>
> There are different kinds of rounding, most of them having
> to handle 0.5 values. For some uses this is enough:
>
> select cast(x + 0.5 as integer) from rdb$database;
>
>
> --
> Milan Babuskov
> http://swoes.blogspot.com/
> http://www.flamerobin.org
>