ajBigNumInt function
Description
Returns a BigNumber whose value is the value of number rounded to an integer using rounding mode round_mode.
Syntax
ajBigNumInt(number,round_mode)
Argument Name | Argument Type | Description |
---|---|---|
number (required) | String | A number in number or string format. For example, -1 or "-1". |
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
Example 1
When only number was inputted, default round mode is 4 (round half up).
=ajBigNumInt(3.3)
The function returns the big number string "3".
Example 2
=ajBigNumInt("12345678901234567890.3",0)
The function returns the big number string "12345678901234567891".
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. |
Invalid round mode, it should be between 0 and 8. |