Subtract the given interval (`other`) from this interval. Say we have intervals `[a1, b1]` and `[a2, b2]`, then their difference is `[a1 - b2, b1 - a2]`. Note that this represents all possible values the difference can take if one can choose single values arbitrarily from each of the operands.
(&self, other: T)
| 793 | /// difference can take if one can choose single values arbitrarily from |
| 794 | /// each of the operands. |
| 795 | pub fn sub<T: Borrow<Interval>>(&self, other: T) -> Result<Self> { |
| 796 | let rhs = other.borrow(); |
| 797 | let dt = |
| 798 | BinaryTypeCoercer::new(&self.data_type(), &Operator::Minus, &rhs.data_type()) |
| 799 | .get_result_type()?; |
| 800 | |
| 801 | Ok(Self::new( |
| 802 | sub_bounds::<false>(&dt, &self.lower, &rhs.upper), |
| 803 | sub_bounds::<true>(&dt, &self.upper, &rhs.lower), |
| 804 | )) |
| 805 | } |
| 806 | |
| 807 | /// Multiply the given interval (`other`) with this interval. Say we have |
| 808 | /// intervals `[a1, b1]` and `[a2, b2]`, then their product is `[min(a1 * a2, |