FirebirdSQL logo

MOD()

Remainder

Result type

SMALLINT, INTEGER or BIGINT depending on the type of a.If a is a floating-point type, the result is a BIGINT.

Syntax
MOD (a, b)
Table 1. MOD Function Parameters
Parameter Description

a

An expression of a numeric type

b

An expression of a numeric type

Returns the remainder of an integer division.

  • Non-integer arguments are rounded before the division takes place.So, “mod(7.5, 2.5)” gives 2 (“mod(8, 3)”), not 0.

  • Do not confuse MOD() with the mathematical modulus operator;e.g. mathematically, -21 mod 4 is 3, while Firebird’s MOD(-21, 4) is -1.In other words, MOD() behaves as % in languages like C and Java.

PI()

Approximation of pi.

Result type

DOUBLE PRECISION

Syntax
PI ()