Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mathematical rounding
Message
From
31/01/2005 19:30:23
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00982326
Message ID:
00982547
Views:
25
>>>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! ;)
>>
>>Result should be 12.4
>>
>>Here's why according to my theory of "equality for the digits"
>>
>>12.340, 12.341, 12.342, 12.343, 12.344 all rounded to 12.3
>>12,345, 12.346, 12.347, 12.349, 12.349 all rounced to 12.4
>>
>>That way 5 are rounded up and 5 are rounded down. So rounding is fair for the digits.
>
>So, what is then the consequence for your code? Or don't you ever use ROUND() ?
>
>>If the result would be what you thought
>>
>>12.340, 12.341, 12.342, 12.343, 12.344, 12.345 rounded to 12.3
>>12.346, 12.347, 12.348, 12.349 rounded to 12.4
>>
>>Now with this you see that it's not fair for the digits. They are not treated equally.
>>
>>I thought that this reply based on respecting the digits was necessary 8-D

Excuse me Peter you were right. I did'nt read it right first I thought the rounding was made for the second digital place.

So my revised answer would be 12.3. Sorry again.
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Previous
Reply
Map
View

Click here to load this message in the networking platform