math.mod

This function returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.

Syntax

math.mod(x, y)

Arguments

Argument

Type

Description

x

number

The dividend or first input

y

number

The divisor or second input

Returns

Type

Description

number

The remainder of the Euclidean division of x by y

Examples

The function math.mod(7, 4) returns 3.0.