Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mathematical rounding
Message
De
31/01/2005 17:28:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
31/01/2005 12:43:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00982326
Message ID:
00982506
Vues:
21
>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! ;)

Normally you want to round to the closest. 12.345 is closer to 12.3 than to 12.4 - calculate the difference to see whether this is true.

The only place where there can be controversy, and where there is really no "correct" method, but only agreements, is when the number to be rounded is exactly in the middle. 15.85 is just as close to 15.8 than to 15.9. The principle usually used in computing is to always round up in this case, but several other agreements exist.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform