Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to fix rounding bug
Message
De
24/10/2007 03:18:51
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01258001
Message ID:
01262964
Vues:
21
hmmm...
Not perfect.
Try with m.nNumber = -9 and m.nPrecision = 2
The result is -8.99

This is better:

Lparameters m.nNumber , m.nPrecision
Return Iif( m.nNumber < 0 , ;
-1 * Round(Int(Val(Transform(-1* m.nNumber*10^m.nPrecision+.5)))/10^m.nPrecision, m.nPrecision), ;
Round(Int(Val(Transform(m.nNumber*10^m.nPrecision+.5)))/10^m.nPrecision, m.nPrecision) )
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform