Skip to main content

exceeds_fail_threshold

Function exceeds_fail_threshold 

Source
fn exceeds_fail_threshold(
    batch_failures: usize,
    batch_len: usize,
    max_pct: u8,
) -> bool
Expand description

batch_failures / batch_len (as a percentage) exceeds max_pct. Cross-multiplies instead of computing a truncated integer percentage first — batch_failures * 100 / batch_len rounds DOWN before comparing, so e.g. 1 failure in a batch of 3 (33.3%) reads as 33 and never exceeds max_pct = 33, silently missing the threshold it was meant to catch (Codex P2, PR #2687 review). batch_failures * 100 > max_pct * batch_len is the same inequality with no rounding.