Helper function used for adding the end-point values of intervals. 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, and the following interval creation is standardized with `Interval::n
(
dt: &DataType,
lhs: &ScalarValue,
rhs: &ScalarValue,
)
| 1069 | /// (`dt`) is validated prior to calling this function, and the following |
| 1070 | /// interval creation is standardized with `Interval::new`. |
| 1071 | fn add_bounds<const UPPER: bool>( |
| 1072 | dt: &DataType, |
| 1073 | lhs: &ScalarValue, |
| 1074 | rhs: &ScalarValue, |
| 1075 | ) -> ScalarValue { |
| 1076 | if lhs.is_null() || rhs.is_null() { |
| 1077 | return ScalarValue::try_from(dt).unwrap(); |
| 1078 | } |
| 1079 | |
| 1080 | match dt { |
| 1081 | DataType::Float64 | DataType::Float32 => { |
| 1082 | alter_fp_rounding_mode::<UPPER, _>(lhs, rhs, |lhs, rhs| lhs.add_checked(rhs)) |
| 1083 | } |
| 1084 | _ => lhs.add_checked(rhs), |
| 1085 | } |
| 1086 | .unwrap_or_else(|_| handle_overflow::<UPPER>(dt, Operator::Plus, lhs, rhs)) |
| 1087 | } |
| 1088 | |
| 1089 | /// Helper function used for subtracting the end-point values of intervals. |
| 1090 | /// |
nothing calls this directly
no test coverage detected
searching dependent graphs…