Functions
math.round()
Rounds `number` to the nearest whole number and returns an int. Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot. In the series form the precision is itself series, so how many places you keep can differ from bar to bar.
Syntax · 1 of 8
math.round(const float number) → const int
Arguments
number required const float The number to round. Return Type
const int Syntax · 2 of 8
math.round(input float number) → input int
Arguments
number required input float The number to round. Return Type
input int Syntax · 3 of 8
math.round(simple float number) → simple int
Arguments
number required simple float The number to round. Return Type
simple int Syntax · 4 of 8
math.round(series float number) → series int
Arguments
number required series float The number to round. Return Type
series int Syntax · 5 of 8
math.round(const float number, const int precision) → const float
Arguments
number required const float The number to round. precision required const int How many decimal places to keep. It is an int, and it is required in the two-argument form - there is no default to fall back on. Return Type
const float Syntax · 6 of 8
math.round(input float number, input int precision) → input float
Arguments
number required input float The number to round. precision required input int How many decimal places to keep. It is an int, and it is required in the two-argument form - there is no default to fall back on. Return Type
input float Syntax · 7 of 8
math.round(simple float number, simple int precision) → simple float
Arguments
number required simple float The number to round. precision required simple int How many decimal places to keep. It is an int, and it is required in the two-argument form - there is no default to fall back on. Return Type
simple float Syntax · 8 of 8
math.round(series float number, series int precision) → series float
Arguments
number required series float The number to round. precision required series int How many decimal places to keep. It is an int, and it is required in the two-argument form - there is no default to fall back on. Return Type
series float