Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mod() function Bug?
Message
From
28/09/2006 12:11:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/09/2006 11:51:33
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01156435
Message ID:
01157882
Views:
31
>OK, perhaps just a mention that the return when negative numbers are used will not be what you expect. By the way, is VB incorrect when it returns -1 or have they redefined the meaning of MOD to mean just the remainder when you divide by both negative and positive numbers?
>
>The definition in the VFP help file reads 'Divides one numeric expression by another numeric expression and returns the remainder.' I am not a math guy so I just believed the definition given and, therefore, I would expect MOD(-13,4) to return -1.

VB is not incorrect. It's their definition (as well as say C#'s). It's remainder as it says in C#, VFP doc lies IMHO:)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform