>>Hi to all,
>>
>>Here is the controversy:
12.345 -> 12.3
>> -> 12.4
In my opinion, the first one (12.3) is the correct 'mathematical rounding' (to 1 decimal here). However, some colleagues say the second one is correct.
>>
>>Please, tell me that I'm correct! ;)
>
>
>sorry, but you are incorrect.
>
>roundiung starts at the very end. therefore, the 5 gets rounded up, changing the 4 into a five.
>
Take the number 45 and round it to the nearest 100. Your logic would indicate that you round the 5 up producing 50 and then round this up to 100.
I can't believe that would be true and I don't see any reason why rounding decimals should be different from rounding integers.
Have I read you properly?
>since the 4 is a 5 now, this one gets rounded up making out of the 3 a 4.
>
>so you end up with 12.4
>
>if you limit the round() function to how many decimals it is supposed to look at the result will change.
>
>?round(12.345, 1) = 12.3 because the function ignores the 5