BUG: pseudo_huber: avoid over- and underflow of `delta^2` and `(r / delta)^2` #518
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 113 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.289
Diff Size
diff_size
0.283
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #518"
general
weight: 0.35
dschmitz89
Reference issue
Addresses part 2 of #362.
What does this implement/fix?
This computes
delta^2 (sqrt(1 + (r / delta)^2) - 1)asr^2 / (sqrt(1 + (r / delta)^2) + 1), scaled by the larger of|r|anddelta(as inhypot). So there is no cancellation, and over- or underflowing intermediates no longer give wrong results. As a side effect,pseudo_huber(inf, r)now returnsr^2 / 2instead ofnanfor finiter.Additional information
The new test fails on
mainwith GCC and Clang (inf,nanand0) and passes with the fix. There are no xsref tables forpseudo_huber; the existingtest_convex_analysis.cpptests pass.AI Generation Disclosure
Claude Opus 5.5 (Claude Code) wrote the fix, the test, and this description, following the plan in this comment. GPT-6.1 Sol (Codex CLI) reviewed it.