InterSystems IRIS Data Platform 2019.2  /  InterSystems SQL Reference

InterSystems SQL Reference
Previous section           Next section
InterSystems: The power behind what matters   

A scalar numeric function that returns the modulus (remainder) of a number divided by another.

{fn MOD(dividend,divisor)}
dividend A number that is the numerator (dividend) of the division.
divisor A number that is the denominator (divisor) of the division.
MOD returns the NUMERIC data type unless the dividend is data type DOUBLE. If dividend is DOUBLE, MOD returns DOUBLE.
MOD returns the mathematical remainder (modulus) from the dividend by the divisor.
MOD can be specified as either a standard scalar function or an ODBC scalar function with curly brace syntax.
The precision reported for MOD (either syntax form) is the same as the precision report for the arithmetic expression dividend/divisor.
ANSI Operator Precedence
The behavior of the MOD function with a single negative operand depends on the Apply ANSI Operator Precedence configuration setting:
The behavior of the # modulo operator is not affected by the Apply ANSI Operator Precedence configuration setting.
The following example shows the remainder returned by MOD.
SELECT MOD(5,3) AS Remainder
returns 2.
SELECT MOD(5.3,.5) AS Remainder
returns .3.
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-23 05:52:04