Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG in round() function?!?
Message
De
29/01/2004 14:05:35
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
29/01/2004 09:12:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00871732
Message ID:
00871952
Vues:
24
f>Hi Fabio,
>
>Sorry, i don't understand your reply. I'm not talking about table fields and sum() but just the round funtion:
>
>?round(147.3250000000,2)
>* = 147.33
>?round(147.32500000000,2)
>* = 147.32
>
>
>Willem-Jan van Ede
>Vektis BV

Internally, VFP represents data in scientific notation, in binary. There are sometimes small roundings errors in the conversion from binary to decimal, and vice-versa. Most of the time you won't notice this; sometimes you will.

Try round($147.325, 2); perhaps this gives you better results. Note that currency only supports 4 decimals.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform