Modulus Operator

Navigation:  Language Reference > Operators > Arithmetic >

Modulus Operator

Previous pageReturn to chapter overviewNext page

Syntax

a mod b

Description

a mod b returns the signed remainder after division:

a mod b = a - trunc(a / b) *b

Examples

a

b

a mod b

10

5

0

9.9

5

4.9

-8

2

0

-7.9

2

-1.9

-7.9

-2

-1.9

Limitations

a and b must be scalars.