DMOD, FMOD, and IMOD: Calculating the Remainder From a Division

How to:

The MOD functions calculate the remainder from a division. Each function returns the remainder in a different format.

The functions use the following formula.

remainder = dividend - INT(dividend/divisor) * divisor
  • DMOD returns the remainder as a decimal number.
  • FMOD returns the remainder as a floating-point number.
  • IMOD returns the remainder as an integer.

Syntax: How to Calculate the Remainder From a Division

function(dividend, divisor, output)

where:

function

Is one of the following:

DMOD returns the remainder as a decimal number.

FMOD returns the remainder as a floating-point number.

IMOD returns the remainder as an integer.

dividend

Numeric

Is the number being divided.

divisor

Numeric

Is the number dividing the dividend.

output

Numeric

Is the result whose format is determined by the function used.

If the divisor is zero (0), the dividend is returned.

Example: Calculating the Remainder From a Division

WebFOCUS

Feedback