toStringAsExponential method
Return a string representing the value of this Big in exponential notation rounded to dp
fixed
decimal places using rounding mode rm
, or Big.rm if rm
is not specified.
dp
? int Decimal places: integer, 0 to maxDp inclusive.rm
? RoundingMode Rounding mode
Implementation
String toStringAsExponential({int? dp, RoundingMode? rm}) {
var x = this, n = x.c[0];
if (dp != null) {
if (dp != ~~dp || dp < 0 || dp > maxDp) {
throw BigError(
code: BigErrorCode.dp,
);
}
x = _round(Big(x), ++dp, rm);
for (; x.c.length < dp;) {
x.c.add(0);
}
}
return stringify(x, true, n != 0);
}