Decimal.Decimal.rescale: def of bend-kit-bignum@0.1.0.0 Import: import bend-kit-bignum@0.1.0.0/decimal.bend as Decimal Lines 203-208 of bend-kit-bignum@0.1.0.0/decimal.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-bignum@0.1.0.0/decimal.bend&start_line=203&end_line=208 import Base # The same value at scale t, or None when that would drop a nonzero digit: # rescale(1.5, 2n) is 1.50; rescale(1.25, 1n) is None, never 1.2 or 1.3. def Decimal.rescale(d: Decimal, +t: Nat) -> Maybe<&2, Decimal>: match d: case Decimal{u, +s}: Decimal.rescale.if(Nat.is_le(s, t), u, s, t) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=bend-kit-bignum@0.1.0.0/decimal.bend&name=Decimal https://jend.leeeet.dev/definition.txt?path=bend-kit-bignum@0.1.0.0/decimal.bend&name=Decimal.rescale.if