Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INT()egering a Numeric type, expected value isn't correc
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00383077
Message ID:
00383581
Vues:
17
x = 3.999999999999999
z = x * 4
? z        && Prints 16.000000000000000
? int(z)   && Prints 15
In the above it is the ? x that is wrong not the INT(x). x is not 16, but is close to but below 16. INT(x) does exactly what it should do which is to return the integer portion of the value regardless of the decimal portion.

This is a rounding error that is always going to be a problem.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform