Add the given interval (`other`) to this interval. Say we have intervals `[a1, b1]` and `[a2, b2]`, then their sum is `[a1 + a2, b1 + b2]`. Note that this represents all possible values the sum can take if one can choose single values arbitrarily from each of the operands.
(&self, other: T)
| 776 | /// that this represents all possible values the sum can take if one can |
| 777 | /// choose single values arbitrarily from each of the operands. |
| 778 | pub fn add<T: Borrow<Self>>(&self, other: T) -> Result<Self> { |
| 779 | let rhs = other.borrow(); |
| 780 | let dt = |
| 781 | BinaryTypeCoercer::new(&self.data_type(), &Operator::Plus, &rhs.data_type()) |
| 782 | .get_result_type()?; |
| 783 | |
| 784 | Ok(Self::new( |
| 785 | add_bounds::<false>(&dt, &self.lower, &rhs.lower), |
| 786 | add_bounds::<true>(&dt, &self.upper, &rhs.upper), |
| 787 | )) |
| 788 | } |
| 789 | |
| 790 | /// Subtract the given interval (`other`) from this interval. Say we have |
| 791 | /// intervals `[a1, b1]` and `[a2, b2]`, then their difference is |