Number.RoundAwayFromZero

Last updated 3 months ago

Number.RoundAwayFromZero

Returns the result of rounding positive numbers up and negative numbers down. The number of digits can be specified.

function (optional number as nullable any, optional digits as nullable any) as nullable any

Description

Returns the result of rounding number based on the sign of the number. This function will round positive numbers up and negative numbers down. If digits is specified, number is rounded to the digits number of decimal digits.

Category

Number.Rounding

Examples

Round the number -1.2 away from zero.

Number.RoundAwayFromZero(-1.2)

-2

Round the number 1.2 away from zero.

Number.RoundAwayFromZero(1.2)

2

Round the number -1.234 to two decimal places away from zero.

Number.RoundAwayFromZero(-1.234, 2)

-1.24