Function check_graphite::assertions::operator_string_to_func[][src]

fn operator_string_to_func(
    op: &str,
    op_is_negated: NegOp,
    val: f64
) -> Box<dyn Fn(f64) -> bool>

Take an operator and a value and return a function that can be used in a filter to return only values that do not satisfy the operator.

aka a function that returns only invalid numbers

Note: JSON considers all numbers either floats or arbitrary-precision decimals, so we use f64. Comparing f64 directly equal with each other is dangerous.

We aren’t ever actually doing math on floats, so even though decimal 0.1 != float 0.1, since we are always interpreting as f64 then we’ll get the “wrong” values and compare them to each other. That said, we should probably use an epsilon in here.