def f16_sub2

bendtorch@1.3.0.0 · dtype.bend:73

import bendtorch@1.3.0.0/dtype.bend as Dtype
import Base

73# a subnormal F16 (2^-25 < |x| < 2^-14): the value in units of 2^-24 is mant / 2^sh, sh = 126 - e in 14..24, rounded to
74# nearest even; a result of 0x400 is the smallest normal, which is the right answer
75def f16_sub2(+q: U32, +rem: U32, +half: U32) -> U32:
76  +up = Bool.or(U32.is_gt(rem, half), Bool.and(U32.is_eq(rem, half), U32.is_eq((q .&. 1 : U32), 1)))
77  (q + Bool.to_u32(up) : U32)

Uses (8)

Used by (1)