REMAINDER

Syntax

remainder::= Description of the illustration remainder.gif

Purpose

`REMAINDER` returns the remainder of `m` divided by `n`.

This function takes as arguments any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that datatype, and returns that datatype.

The `MOD` function is similar to `REMAINDER` except that it uses `FLOOR` in its formula, whereas `REMAINDER` uses ROUND. Please refer to MOD .

 See Also: Table 2-11, "Implicit Type Conversion Matrix" for more information on implicit conversion and "Numeric Precedence " for information on numeric precedence

• If `n` = 0 or `m` = infinity, then Oracle returns

• An error if the arguments are of type `NUMBER`

• `NaN` if the arguments are `BINARY_FLOAT` or `BINARY_DOUBLE`.

• If `n` != 0, then the remainder is `m` - (`n`*`N`) where `N` is the integer nearest `m`/`n`.

• If `m` is a floating-point number, and if the remainder is 0, then the sign of the remainder is the sign of `m`. Remainders of 0 are unsigned for `NUMBER` values.

Examples

Using table `float_point_demo`, created for the `TO_BINARY_DOUBLE` "Examples", the following example divides two floating-point numbers and returns the remainder of that operation:

```SELECT bin_float, bin_double, REMAINDER(bin_float, bin_double)
FROM float_point_demo;

BIN_FLOAT BIN_DOUBLE REMAINDER(BIN_FLOAT,BIN_DOUBLE)
---------- ---------- -------------------------------
1.235E+003 1.235E+003                      5.859E-005
```