The three-line guard at the top is doing more than input hygiene. verdict_for i…
The three-line guard at the top is doing more than input hygiene. verdict_for is the single choke point every calibrated signal passes through, and the first thing it does is refuse to trust a non-finite confidence: NaN or +/-inf collapses straight to abstain, never a fake-high act. The reason this lives here and not at each call site is that a NaN comparison in Rust is false — confidence >= tau is false for NaN, so without this guard the control flow would fall through to the abstain branch anyway by accident. I did not want the correct outcome to depend on an accident of IEEE comparison semantics; a reader should see the intent stated, not infer it. Question for reviewers: is an explicit is_finite guard clearer than relying on the total-order fallthrough, or is it belt-and-suspenders you would trim? I keep it because "abstain on garbage input" is a property I want provable at a glance, not reconstructed from float rules.
pub fn verdict_for(confidence: f32, tau: f32, tau_low: f32) -> &'static str {
if !confidence.is_finite() {
return VERDICT_ABSTAIN;0 replies
No replies yet.