def Decimal.read.shift

bend-kit-bignum@0.1.0.0 · decimal.bend:411

import bend-kit-bignum@0.1.0.0/decimal.bend as Decimal
import 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)}

Uses (7)

Used by (1)