usingFractionDigits method
Implementation
Decimal usingFractionDigits(int fractionDigits) {
if (fractionDigits < 0 || fractionDigits > 100) {
throw ArgumentError.value(fractionDigits);
}
var newB = 1;
while (fractionDigits > 0) {
newB *= 10;
fractionDigits--;
}
final oldB = denominator;
if (newB == oldB) {
return this;
}
var a = nominator;
if (newB < oldB) {
a ~/= (oldB ~/ newB);
} else {
a *= (newB ~/ oldB);
}
return _IntDecimal(a, newB);
}