Tamar,
I would argue your statement and say that modulo
is defined for negative numbers, but I can't find good definition of modulo (all my math text books from the university {and high school} are still in Norway). I did find some very iteresting links that discuss the very same thing:
http://mathforum.org/library/drmath/view/52343.htmlhttp://mathforum.org/library/drmath/view/54377.htmlThe first link gives a very good mathematical explanation of whay you should expect when doing mod(-340,60) and VFP's answer is correct.
The second link gives some examples in C about what is going on.
Einar
>>
VFP8:>>MOD(10-12,12) = 10
>>
>>
SQL:>>(10-12) % 12 = -2
>>
>>I need to use Modulo in my sql-syntax - what have I done wrong???
>>
>
>What you've really done wrong is tried to use modulo with a negative number. That operation isn't defined mathematically for negative numbers. However, as you've learned, programming languages let you do it anyway. It's not surprising, though, that two different engines (I'm assuming that by "SQL," you mean SQL Server, not VFP's SQL engine) give you two different results.
>
>Tamar
Semper ubi sub ubi.