34
// The value is rounded down to the nearest representable value.
35
// Negative values go to 0 and values above the maximum representable go to 255.
37
>
if value <= 0 {
39
>
}
40
42
>
bitLen := bits.Len64(uval)
43
>
44
>
// Find shift such that uval >> shift is in [12, 23].
45
>
// This extracts the significand for the normalized representation.
46
>
shift := max(bitLen-5, 0)
47
>
sig := int(uval >> uint(shift))
48
>
if sig >= 24 {
49
>
shift++
50
>
sig = int(uval >> uint(shift))
51
>
}
52
54
>
55
>
if e >= 1 {
57
>
b := e*12 + m
58
>
if b > 255 {
60
>
}
62
}
63
64
// Subnormal: value = m << (offset + 1), m in [1, 11]
66
>
if m < 1 {
68
>
}
70
m = 11
71
}
73
}
74