Returns the minimum of two (possibly inexact) values, conservatively propagating exactness information. If one of the input values is [`Precision::Absent`], the result is `Absent` too.
(&self, other: &Precision<T>)
| 115 | /// propagating exactness information. If one of the input values is |
| 116 | /// [`Precision::Absent`], the result is `Absent` too. |
| 117 | pub fn min(&self, other: &Precision<T>) -> Precision<T> { |
| 118 | match (self, other) { |
| 119 | (Precision::Exact(a), Precision::Exact(b)) => { |
| 120 | Precision::Exact(if a >= b { b.clone() } else { a.clone() }) |
| 121 | } |
| 122 | (Precision::Inexact(a), Precision::Exact(b)) |
| 123 | | (Precision::Exact(a), Precision::Inexact(b)) |
| 124 | | (Precision::Inexact(a), Precision::Inexact(b)) => { |
| 125 | Precision::Inexact(if a >= b { b.clone() } else { a.clone() }) |
| 126 | } |
| 127 | (_, _) => Precision::Absent, |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /// Demotes the precision state from exact to inexact (if present). |
| 132 | pub fn to_inexact(self) -> Self { |