ajBigNumRound function
Description
Returns the value of number after rounded.
Syntax
ajBigNumRound(number, decimal_places, round_mode)
Argument Name | Argument Type | Description |
---|---|---|
number (required) | String | A number in number or string format. For example, -1 or "-1". |
decimal_places (required) | Integer | It is a number value which is to define the no. of places to be rounded. If a decimal number is inputted, it will be rounded down. |
round_mode (optional) | Integer | Rounding mode to be used. Here are the supported rounding modes: 0 - Round up (away from zero) 1 - Round down (towards zero) 2 - Round ceiling (towards infinity) 3 - Round floor (towards -infinity) 4 - Round half up (towards nearest neighbour. If equidistant, rounds away from zero) 5 - Round half down (towards nearest neighbour. If equidistant, rounds towards zero) 6 - Round half even(towards nearest neighbour. If equidistant, rounds towards even neighbour) 7 - Round half ceiling (towards nearest neighbour. If equidistant, rounds towards infinity) 8 - Round half floor (towards nearest neighbour. If equidistant, rounds towards -infinity) The default value is 4 - Round half up. |
The function will return:
1) Return Value: BigNumber String
2) Return Type: Single Value
Example
=ajBigNumRound("12345.12345",4)
The function returns "12345.1235" using round_half_up as default rounding mode.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type. Besides, system will raise error for below scenario(s).
Error Scenario |
---|
Number is neither a number or a string that can be converted to a number. |
Decimal places should be greater than or equal to zero. |
Invalid round mode, it should be between 0 and 8. |