BUG: exprel: fix 1 ulp error for `-eps < x < -eps/2` #661
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 117 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.285
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #661"
general
weight: 0.35
j-bowhay
Reference issue
No issue; item 39 of #629. Found while porting xsf to Rust (https://github.com/jorenham/xsf-rust/pull/2544).
What does this implement/fix?
exprel(-1.3322676295501878e-16)returned1.0instead of0.9999999999999999. Since $\mathrm{exprel}(x) = 1 + x/2 + O(x^2)$, the|x| < epsbranch now returns1 - eps/2forx < -eps/2(and1otherwise), which is correctly rounded there. A comparison avoids underflow inx/2for subnormalxand double rounding near-eps/2.Additional information
The new test (exact comparison, since the error is 1 ulp) fails on
mainwith GCC and Clang (exprelreturns1) and passes with the fix; theexprelxsref table test passes.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.