Pb.double.of_f32bits: def of bendonnect-rpc@0.1.0.0 Import: import bendonnect-rpc@0.1.0.0/src/pb.bend as Pb Lines 320-334 of bendonnect-rpc@0.1.0.0/src/pb.bend: https://jend.leeeet.dev/read.txt?path=bendonnect-rpc@0.1.0.0/src/pb.bend&start_line=320&end_line=334 import Base import bend-kit-protobuf@0.1.0.0/protobuf.bend as Pb # IEEE binary32 bits -> binary64 bits (exact). def double.of_f32bits(+b: U32) -> Pb.Word64: +s = ((b >> 31n) << 31n : U32) +e = ((b >> 23n) .&. 255 : U32) +m = (b .&. 8388607 : U32) +p = msb(m) +sub = word64.shl(Pb.Word64{0, (m - (1 << U32.to_nat(p)) : U32)}, (52 - p : U32)) +mh = (m >> 3n : U32) +ml = ((m .&. 7) << 29n : U32) +nh = (s .|. ((e + 896) << 20n) .|. mh : U32) +sh = (s .|. 2146435072 .|. mh : U32) +uh = (s .|. ((p + 874) << 20n) .|. word64.hi(sub) : U32) Pb.Word64{ Bool.pick(U32, U32.is_eq(e, 255), sh, Bool.pick(U32, U32.is_zero(e), Bool.pick(U32, U32.is_zero(m), s, uh), nh)), Bool.pick(U32, U32.is_zero(e), Bool.pick(U32, U32.is_zero(m), 0, word64.lo(sub)), ml)} Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shln https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shrn https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=Word64 https://jend.leeeet.dev/definition.txt?path=bendonnect-rpc@0.1.0.0/src/pb.bend&name=msb https://jend.leeeet.dev/definition.txt?path=bendonnect-rpc@0.1.0.0/src/pb.bend&name=word64.hi https://jend.leeeet.dev/definition.txt?path=bendonnect-rpc@0.1.0.0/src/pb.bend&name=word64.lo https://jend.leeeet.dev/definition.txt?path=bendonnect-rpc@0.1.0.0/src/pb.bend&name=word64.shl