formatMantissaU method Null safety
Format the unsigned part of the mantissa to the given number of digits. Result will be either digits or digits+1 characters long.
Implementation
@protected
String formatMantissaU(Value v, int digits) {
assert(digits >= 0 && digits <= 10);
final charCodes = List.filled(10, 0);
int i = charCodes.length;
if (digits < 10) {
bool carry = v.mantissaDigit(digits) >= 5;
while (carry && digits > 0) {
final d = v.mantissaDigit(--digits) + 1;
if (d == 10) {
charCodes[--i] = _ascii0;
} else {
charCodes[--i] = _ascii0 + d;
carry = false;
}
}
if (carry) {
charCodes[--i] = _ascii0 + 1;
}
}
while (digits > 0) {
charCodes[--i] = _ascii0 + v.mantissaDigit(--digits);
}
return (String.fromCharCodes(charCodes, i));
}