Evaluate the comparison.
(&self, value: f64, threshold: f64)
| 81 | |
| 82 | /// Evaluate the comparison. |
| 83 | pub fn evaluate(&self, value: f64, threshold: f64) -> bool { |
| 84 | match self { |
| 85 | Self::Gt => value > threshold, |
| 86 | Self::Gte => value >= threshold, |
| 87 | Self::Lt => value < threshold, |
| 88 | Self::Lte => value <= threshold, |
| 89 | Self::Eq => (value - threshold).abs() < f64::EPSILON, |
| 90 | Self::Neq => (value - threshold).abs() >= f64::EPSILON, |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /// SQL representation. |
| 95 | pub fn as_sql(&self) -> &'static str { |