Welcome Guest, Not a member yet? Register   Sign In
rounding a decimal
#6

[eluser]linuxbz[/eluser]
[quote author="Nanodeath" date="1183458693"]Just beware of the return types (round and floor both return a float for some reason).[/quote]

Good point. Well, round() makes some sense because you can round it to a desired number of decimal places. The floor() function makes less sense, unless it is perhaps because you might want to floor() a larger number than the maximum integer size? I have heard that justification for a float before, though I can't think of an actual application of it.

Actually, as often as this kind of situation comes up, an argument to floor() like the number of decimals to round() might be handy for some people.


Messages In This Thread
rounding a decimal - by El Forum - 07-02-2007, 08:42 PM
rounding a decimal - by El Forum - 07-02-2007, 10:41 PM
rounding a decimal - by El Forum - 07-02-2007, 11:20 PM
rounding a decimal - by El Forum - 07-02-2007, 11:28 PM
rounding a decimal - by El Forum - 07-02-2007, 11:31 PM
rounding a decimal - by El Forum - 07-03-2007, 12:23 AM
rounding a decimal - by El Forum - 07-03-2007, 12:54 AM
rounding a decimal - by El Forum - 07-03-2007, 06:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB