Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare to 0 (zero)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01662504
Message ID:
01662505
Vues:
46
>Hi,
>
>I have an expression that compares if a value in a table/cursor field is equal to 0 (zero). The field is of type numeric with two decimals (e.g. 3.44, 0.00, 1.01)
>
>Which syntax is more reliable to use:
>
>cursor.field = 0 or <another expression>
>
>or
>
>cursor.field = 0.00 or <another expression>
>
>
>TIA

Both are correct if it comes to field.
If you compare variable sometime 0 is not equal to 0 :-)
because variable can be something like that: 0.000000000000001 and you will see it in debugger as 0 but it is not :-)
So if you compare variable and zero better use:
ROUND(variable, 2) = 0
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform