A newer version of Max is available. Click here to access the latest version of the documentation

% Reference

Divide two numbers, output the remainder

%

Description

% takes two numbers, divides one by the other and outputs the remainder of the division.

Examples

Find the remainder of a division

Arguments

initial-value [int]

Optional

Sets an initial value for the divisor. If there is no argument, the divisor is set to 1 initially.

Attributes

Common Box Attributes

Messages

bang

In left inlet: Performs the operation with the numbers currently stored.

int

Arguments

input [int]
In left inlet: The number is divided by the number in the right inlet, and the remainder is sent out the outlet.

  (inlet1)

Arguments

divisor [int]
In right inlet: The number is stored as the divisor (the number to be divided into the number in the left inlet) for calculating the remainder.

float

Arguments

input [float]
Converted to int.

set

Arguments

set-input [int]
Sets the number to be divided without causing output (bang will output it).

list

Arguments

number-divided and divisor [list]
In left inlet: The first number is divided by the second number, and the remainder is sent out the outlet.

Output

int

When the two numbers in the inlets are divided, the remainder is sent out the outlet. % is called the modulo operator.

See Also

Name Description
expr
!/
/
Max Basic Tutorial 6: Simple Math in Max Max Basic Tutorial 6: Simple Math in Max