def encode.fin
import bend-lawful-stdlib@0.1.0.0/src/float/sf32.bend as Sf32import Base
import bend-lawful-stdlib@0.1.0.0/src/float/bin.bend as Bin
110# a finite value that fits binary32, as bits: 24 mantissa bits when
111# normal, fewer at the smallest exponent when subnormal
112def encode.fin(neg: Bool, +m: Bin.Bin, +e: Nat) -> F32:
113 +t = Nat.max(Nat.sub(Nat.add(e, Bin.len(m)), 24n), 151n)
114 put(neg, t, align(m, e, t, Nat.is_ge(t, e)))