RPA JS 扩展开发文档

RPA JS 扩展开发文档

  • SDK接口说明
  • 代码示例

xsy-breeze-ui-rpa > BigNumber > toExponential

BigNumber.toExponential() method

Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode roundingMode to decimalPlaces decimal places, i.e with one digit before the decimal point and decimalPlaces digits after it.

If the value of this BigNumber in exponential notation has fewer than decimalPlaces fraction digits, the return value will be appended with zeros accordingly.

If decimalPlaces is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.

If roundingMode is omitted or is null or undefined, ROUNDING_MODE is used.

Throws if decimalPlaces or roundingMode is invalid.

x = 45.6
y = new BigNumber(x)
x.toExponential()               // '4.56e+1'
y.toExponential()               // '4.56e+1'
x.toExponential(0)              // '5e+1'
y.toExponential(0)              // '5e+1'
x.toExponential(1)              // '4.6e+1'
y.toExponential(1)              // '4.6e+1'
y.toExponential(1, 1)           // '4.5e+1'  (ROUND_DOWN)
x.toExponential(3)              // '4.560e+1'
y.toExponential(3)              // '4.560e+1'

Signature:

toExponential(decimalPlaces: number, roundingMode?: RoundingMode): string;

Parameters

ParameterTypeDescription
decimalPlacesnumber
roundingModeRoundingMode

Returns:

string

Last updated on 12/16/2020
  • BigNumber.toExponential() method
  • Parameters
Copyright © 2021 销售易