xsy-breeze-ui-rpa > BigNumber > decimalPlaces
BigNumber.decimalPlaces() method
Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode roundingMode to a maximum of decimalPlaces decimal places.
If decimalPlaces is omitted, or is null or undefined, the return value is the number of decimal places of the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
If roundingMode is omitted, or is null or undefined, ROUNDING_MODE is used.
Throws if decimalPlaces or roundingMode is invalid.
x = new BigNumber(1234.56)
x.decimalPlaces() // 2
x.decimalPlaces(1) // '1234.6'
x.decimalPlaces(2) // '1234.56'
x.decimalPlaces(10) // '1234.56'
x.decimalPlaces(0, 1) // '1234'
x.decimalPlaces(0, 6) // '1235'
x.decimalPlaces(1, 1) // '1234.5'
x.decimalPlaces(1, ROUND_HALF_EVEN) // '1234.6'
x // '1234.56'
y = new BigNumber('9.9e-101')
y.decimalPlaces() // 102
Signature:
decimalPlaces(): number;
Returns:
number
