Commit d83b4c9
fix(math): log1p/log1pf raise FE_DIVBYZERO at the x=-1 pole (glibc parity)
Differential probe of the pole cases I'd missed: log1p(-1) = log(0) = -inf is a
pole where glibc raises FE_DIVBYZERO, but libm::log1p returns -inf without the
flag (same omit-pattern as the earlier log/tgamma fixes). atanh(±1) poles and
log1p(x<-1) domain errors were already correct (libm raises those).
Fix: re-raise FE_DIVBYZERO when x == -1.0 via the force_eval idiom (-1.0/0.0 ->
-inf + DIVBYZERO); the value is unchanged. f32 log1pf likewise.
Gate: conformance_diff_fp_exceptions extended with the atanh/log1p pole+domain
cases (incl. the verified-correct atanh poles and log1p domain, pinned). All 155
math lib tests pass; 0 divergences vs host glibc.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 724ea87 commit d83b4c9
3 files changed
Lines changed: 23 additions & 0 deletions
File tree
- crates
- frankenlibc-abi/tests
- frankenlibc-core/src/math
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
127 | 141 | | |
128 | 142 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
484 | 489 | | |
485 | 490 | | |
486 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
| |||
0 commit comments