def Decimal.read.shift
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
411# A negative exponent adds scale; a positive one spends scale, then multiplies.
412def Decimal.read.shift(u: Big.BigInt, +sc: Nat, eneg: Bool, +e: Nat) -> Decimal:
413 match eneg:
414 case True{}:
415 Decimal{u, Nat.add(sc, e)}
416 case False{}:
417 Decimal{Decimal.up(u, Nat.sub(e, sc)), Nat.sub(sc, e)}