Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does MOD() work?
Message
De
10/12/1999 23:38:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00302170
Message ID:
00302172
Vues:
26
>From the VFP5 help file...
>
>? MOD(36,10) && Displays 6
>? MOD((4*9), (90/9)) && Displays 6
>? MOD(25.250,5.0) && Displays 0.250
>
>I agree with the first two but why does the last
>one display .250 when 25.25/5=5.05?
>
>Similarly ? mod(1999,4) displays 3 instead of 75.
>
>What am I missing?

The modulo (MOD()) function returns the remainder, when the first argument is divided by the second. Just like the old way of doing long division by hand, that used to be taught in grade school.
25.25 = (5 * 5.0) + 0.250
1999 = (499 * 4) + 3
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform