# Oracle REMAINDER() function

## Description

This function returns the remainder of n2 divided by n1. n1 and n2 are the arguments of this function.

The MOD function is similar to REMAINDER except that the MOD uses FLOOR in its formula, whereas REMAINDER uses ROUND.

##### Uses of Oracle REMAINDER() Function

**Remainder calculation:**Computes the remainder of a division operation between two numbers.**Floating-point arithmetic:**Handles remainders involving floating-point numbers with specific rules for rounding.**Mathematical operations:**Supports mathematical operations where precise remainder calculations are required.**Data analysis:**Useful in data analysis tasks that involve modular arithmetic and precise remainder computations.**Financial and scientific calculations:**Assists in complex calculations in financial and scientific applications that require remainder operations.

**Syntax:**

REMAINDER(n2, n1)

**Rules:**

- When n1 = 0 or n2 = infinity, then returns an error if the type of arguments are NUMBER and NaN if the types of arguments are BINARY_FLOAT or BINARY_DOUBLE.
- When n1 != 0, then the remainder is n2 - (n1*N) where N is the integer nearest n2/n1. If n2/n1 equals x.5, then N is the nearest even integer.
- When n2 is a floating-point number, and if the remainder is 0, then the sign of the remainder is the sign of n2. Remainders of 0 are unsigned for NUMBER values.

**Example**

We have a sample table float_point_test with three columns, dec_num, type 'NUMBER(10,2)', bin_double, type 'BINARY_DOUB LE' and bin_float, type 'BINARY_FLOAT'. Here is the table.

SQL> SELECT * FROM float_point_test; DEC_NUM BIN_DOUBLE BIN_FLOAT ---------- ---------- ---------- 1513.67 1.514E+003 1.514E+003

The example below divides two floating-point numbers and returns the remainder of that operation using the float_point_test table.

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

Here is the result.

BIN_FLOAT BIN_DOUBLE REMAINDER(BIN_FLOAT,BIN_DOUBLE) ---------- ---------- ------------------------------- 1.514E+003 1.514E+003 1.0E-001

**It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.**

https://www.w3resource.com/oracle/oracle-numeric-functions/oracle-remainder-function.php

**Weekly Trends and Language Statistics**- Weekly Trends and Language Statistics