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

round

Round to an input value

Description

round calculates and outputs an integer multiple of any given number.

Arguments

Name Type Opt Description
rounding multiple int or float opt An argument can be used to specify the value to whose nearest multiple the rounding will be done.

Messages

int input [int]
Value to be rounded, Number values received in the left inlet will be rounded to either the absolute nearest integer multiple or the nearest integer multiple between the value received in this inlet or 0 (see the nearest attribute for more information).
float input [float]
Value to be rounded.
list input [list]
Values to be rounded.
anything input [list]
Values to be rounded.

Attributes

Name Type g/s Description
nearest int When set to 1 (the default), the round object will round to the nearest multiple of the specified number value.

Note: This attribute does not set the rounding step (which is set using round object's right inlet), It specifies that rounding to the nearest number value will occur. Here are some examples:

With the rounding interval set to 3 and the nearest attribute set to 1:
an input value of 5.8 will return 6
an input value of 3.7 will return 3
an input value of -1 will return 0
an input value of -2.7 will return -3

With the rounding interval set to 3 and the nearest attribute set to 0:
an input value of 5.8 will return 3
an input value of 3.7 will return 3
an input value of -1 will return 0
an input value of -2.7 will return 0

Information for box attributes common to all objects

Output

float: The nearest whole numbers of the input.
list: List of the nearest whole numbers of the input list.

Examples

See Also

Name Description
expr Evaluate a mathematical expression
vexpr Evaluate a math expression for a list of different inputs
round~ Round an input signal value