sf calls these moments events, computes the same substitute value, and reports the event through the error policy.
The four events
- Overflow
- Underflow
- Divide
- Invalid
The exact result is outside the representable range. The hardware saturates: it returns the largest value with the right sign.Where it happens:
+, -, fma, any cast of a value with |v| >= 1, and a / b whenever |a| >= |b|.Saturation is not undone by later operations: once a sum sticks at the maximum, subtracting what you added does not bring the original back.The value is always the hardware value
The policy decides whether Python raises, warns or stays quiet. It never changes the number. Underignore you get exactly what the chip would hand back:
Order when several events happen at once
An array operation can produce different events in different elements, and the policy can only raise once. Events are handled in a fixed order, called the catalogue order: invalid, divide, overflow, underflow. The first one whose policy israise wins; the rest are warned or ignored per their own setting.
Defaults
Two of the substitute values, divide and invalid, are the chip’s proposed behaviour and are still to be confirmed by the hardware team. They live in one place in the library and will be changed there if the silicon decides otherwise.