Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MOD() - looks like a bug
Message
From
19/02/2002 21:32:18
 
 
To
19/02/2002 20:05:39
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00621577
Message ID:
00622322
Views:
29
>>>What's wrong with mod() returning fractions?
>>>Cetin
>>
>>It's that if you run say CertainRand(2,8) several times the chances are that on a certain run the function will indicate that MOD() returns, for example, 5.25 while arguments that it had were MOD(1145880599506199.0000,6). If you take this statement and execute it in the command window it returns the correct whole number. On the contrary, from within the function the result is a fraction.
>>Regards.
>>Kamil.
>
>It is my understanding that mod() should return integers if the arguments are integers.
>
>Perhaps there is a rounding error. I see that your number has 16 significant digits; the limit for numbers is between 15 and 16 digits. That is simply too much for VFP, IMO.
>
>Hilmar.

his problem is that 1145880599506199.0000 is not an integer
MOD(INT(1145880599506199.0000),6) will return an integer
Previous
Reply
Map
View

Click here to load this message in the networking platform