Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mathematical rounding
Message
De
31/01/2005 18:11:21
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
31/01/2005 12:43:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00982326
Message ID:
00982532
Vues:
27
>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! ;)

Here: "that I'm correct!". Better?

If you're actually after our opinions, then mine is that since digits 0-4 round down, 5-9 should round up, which in the long run balances the roundup error. Specially if you can't be sure there's an infinite array of zeros after the 5.

So if we're after the least rounding error, digit 5 should round up (as Fox rightfully does for all these years).

In this particular case, we're rounding to one decimal - so the next digit is a 4, which rounds down. In general, rounding goes for the least error, which anyone can calculate. So the only borderline case is when we have just one extra digit that we round, and that digit is a five.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform