def strip

bend-lawful-stdlib@0.1.0.0 · src/float/format.bend:35

import bend-lawful-stdlib@0.1.0.0/src/float/format.bend as Format
import Base
import bend-lawful-stdlib@0.1.0.0/src/float/bin.bend as Bin

35# the same value with its low zero bits moved into the exponent and its
36# high zero bits dropped, so that equal values are equal terms
37def strip(neg: Bool, m: Bin.Bin, e: Nat) -> Val:
38  match m:
39    case Bin.BZ{}:
40      Z{neg}
41    case Bin.B0{r}:
42      strip(neg, r, 1n+e)
43    case Bin.B1{r}:
44      Fin{neg, Bin.B1{Bin.trim(r)}, e}

Uses (5)

Used by (1)