Quantcast
Channel: Recent Edits
Viewing all articles
Browse latest Browse all 12198

Caution when using Moduluo on negative arguments...

$
0
0
It is important to note that SQL differs from some other programming languages in how the modulo operation defines the sign when one of the arguments is negative. In SQL, SELECT (-4)%3 returns -1, while in PERL or Mathematica, it would return 2. One can make a case that either is correct, but it will affect how one builds an algorithm around the operation. In SQL the sign of the result is the same as that of the DIVIDEND, while in many other languages it is based on the DIVISOR.

Viewing all articles
Browse latest Browse all 12198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>