title: “MATH::ROUND Function” author: “Pierre Laplante laplante@plcb.ca” date: “2023-11-22” version: “1.0.0” section: “1g”
math::round returns the nearest integer value to x.
math::round or round(expression[, decimal: integer])
The math::round
function returns the nearest integer value to x.
By default, rounding is performed half away from zero (i.e., 0.5 rounds to 1, -0.5 rounds to -1).
When the optional decimal parameter is provided (from 0 to 10), the result is rounded to the specified number of decimal places.
res={{
round(2.5); // 3
round(-2.5); // -3
round(3.14159, decimal:2); // 3.14
round(-3.14159, decimal:2); // -3.14
round([1.1, 2.5, 3.7]); // [1, 3, 4]
round({"x": 2.718, "y": 3.14159}, decimal:3); // {"x":2.718,"y":3.142}
}}.
return
res=3-33.14-3.14[1,3,4]{"x":2.718,"y":3.142}.
Pierre Laplante laplante@plcb.ca