divide method
PgDecimal
divide(
- PgDecimal other, {
- required int scale,
- PgRoundingMode mode = PgRoundingMode.halfAwayFromZero,
Divisão com scale dígitos depois da vírgula, arredondada conforme
mode.
Implementation
PgDecimal divide(PgDecimal other,
{required int scale,
PgRoundingMode mode = PgRoundingMode.halfAwayFromZero}) {
final special = _divideSpecial(other);
if (special != null) return special;
// Um único arredondamento, também para escala negativa.
final rounded = _divideUnscaled(other, scale, mode);
if (scale >= 0) return PgDecimal._finiteValue(rounded, scale);
return PgDecimal._finiteValue(rounded * _pow10(-scale), 0);
}