Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does MOD() work?
Message
From
10/12/1999 23:38:23
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00302170
Message ID:
00302172
Views:
27
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform