Skip to main content

compute_ratio

Function compute_ratio 

Source
pub fn compute_ratio(tokens_before: usize, tokens_after: usize) -> f64
Expand description

tokens_after / tokens_before, 0.0 when tokens_before == 0.

Why: never divide by zero, never produce NaN — a JSONL consumer (Slice C’s report, or a human jq-ing the file) must never have to guard against either. Test: tests::ratio_guards_divide_by_zero, tests::ratio_is_after_over_before.