BUG: hyp2f1: fix infinite recursion for large `c` #655
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.25) × (1 − Review Confidence (0.48)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.25 · 12 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.00 · 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.350
Diff Size
diff_size
0.153
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
2 items
Approved
Approved these changes.
j-bowhay
jorenham
Reference issue
No issue; item 37 of #629.
What does this implement/fix?
The real
hyp2f1(1e17, 0.5, 1e17, nan)overflows the stack (in SciPy 1.18.1 too); expectednan. When the series fails forc - a - b < 0, the recurrence onc(AMS55 15.2.27) restarts fromc + (2 - round(c - a - b)), which rounds back tocfor largec, so it called itself with the same arguments. This skips the recurrence in that case and keeps the series result.Additional information
Finite
xhit the same loop:hyp2f1(1e17 - 1e7, 1e7 + 0.5, 1e17, 0.5)now returnsinf, andhyp2f1(1e17 - 16, 16.5, 1e17, 0.9999)returnsnaninstead of crashing. Only inputs that used to recurse forever change. The new test crashes (SIGSEGV) onmainwith GCC and Clang and passes with the fix; the hyp2f1 xsref table tests pass.AI Generation Disclosure
Claude Opus 5.5 wrote the fix, the test, and this description, following the plan in this comment. GPT-6.2 Sol reviewed it.