Widening is exact
Every sf8 value is also an sf16 value (the code is shifted left by 8). Widening therefore never loses anything and never raises. It happens automatically when you mix widths:sf.sf8(0.1) is 13/128 = 0.1015625, and widening preserves that, not the original 0.1.
Narrowing must be explicit
Going to fewer bits re-quantizes: the value is rounded to the nearest code of the narrower format (ties to even), and if that rounding overflows or underflows, the event goes through the policy.SFTypeError:
Arrays
sf.cast(arr, dtype) and arr.astype(dtype) do the same element by element, reporting events with counts. Arrays: creating →
Which widths exist
All of sf4 to sf16 on the host. The device accepts sf16 only; placing a narrower array on a device raisesSFTypeError.