fn handle_overflow<const UPPER: bool>(
dt: &DataType,
op: Operator,
lhs: &ScalarValue,
rhs: &ScalarValue,
) -> ScalarValueExpand description
This function handles cases where an operation results in an overflow. Such results are converted to an unbounded endpoint if:
- We are calculating an upper bound and we have a positive overflow.
- We are calculating a lower bound and we have a negative overflow.
Otherwise, the function sets the endpoint as:
- The minimum representable number with the given datatype (
dt) if we are calculating an upper bound and we have a negative overflow. - The maximum representable number with the given datatype (
dt) if we are calculating a lower bound and we have a positive overflow.
Caution: This function contains multiple calls to unwrap(), and may
return non-standardized interval bounds. Therefore, it should be used
with caution. Currently, it is used in contexts where the DataType
(dt) is validated prior to calling this function, op is supported by
interval library, and the following interval creation is standardized with
Interval::new.