BigFloat.prototype.toPrecision

Returns a string representation of the BigFloat rounded to the specified number of digits.

Syntax

toPrecision(digits, roundingMode?, radix?)

Parameters

Return value

A string representing the value. Can be in exponential notation.

Examples

123.4567l.toPrecision(1)
"1e+2"
123.4567l.toPrecision(4)
"123.5"
123.4567l.toPrecision(4, BigFloatEnv.RNDD)
"123.4"
123.4567l.toPrecision(4, BigFloatEnv.RNDD)
"123.4"
123.4567l.toPrecision(4, BigFloatEnv.RNDD, 16)
"7b.74"