def Decimal.from_fraction
import bend-kit-bignum@0.1.0.0/decimal.bend as Decimalimport Base
import bend-kit-bignum@0.1.0.0/bigint.bend as Big
147# n / d at the smallest exact scale, or None when d is zero or the decimal
148# expansion does not terminate (d has a prime factor other than 2 and 5).
149def Decimal.from_fraction(n: Big.BigInt, +d: Big.BigInt) -> Maybe<&2, Decimal>:
150 Decimal.frac.if(Big.BigInt.is_zero(d), n, d)