def encode
import bend-collections-laws-math@1.0.0.0/spec/math/f64.bend as F64import Base
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C
import bend-collections-laws-math@1.0.0.0/src/math/f64.bend as F
93# the double with sign s, exponent field ef < 2^11 and fraction f < 2^52:
94# (s * 2^11 + ef) * 2^52 + f
95def encode(+s: Bool, +ef: Nat, +f: Nat) -> F.F64:
96 F.Bits{U32.from_nat(C.low(32n, f)), U32.from_nat(Nat.add(C.high(32n, f), C.shift(20n, Nat.add(ef, C.shift(11n, b2n(s))))))}