Commit 50efd8b
fix(math): powf underflow sets ERANGE regardless of exponent sign (glibc parity)
powf's range-error branch required `y > 0.0` in its underflow case, so a
negative-exponent underflow (e.g. powf(2, -200) -> 0) silently skipped
ERANGE while glibc raises it. The f64 pow already uses the sign-agnostic
`out == 0.0 && x != 0.0`; aligned powf to match.
Verified against the gcc -lm oracle (powf(2,-200), powf(10,-50),
powf(0.5,200) all ERANGE). Added two debug-mode unit tests
(powf_underflow_{negative,positive}_exponent_sets_range_errno) — the in-crate
debug harness is the one that actually exercises fl's powf body (the release
integration path const-folds/interposes constant-arg powf calls). 116 math_abi
unit tests pass; conformance_math_errno gate green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 40b7193 commit 50efd8b
1 file changed
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1058 | 1058 | | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | | - | |
1062 | | - | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1063 | 1066 | | |
1064 | 1067 | | |
1065 | 1068 | | |
| |||
8091 | 8094 | | |
8092 | 8095 | | |
8093 | 8096 | | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
| 8100 | + | |
| 8101 | + | |
| 8102 | + | |
| 8103 | + | |
| 8104 | + | |
| 8105 | + | |
| 8106 | + | |
| 8107 | + | |
| 8108 | + | |
| 8109 | + | |
| 8110 | + | |
| 8111 | + | |
| 8112 | + | |
| 8113 | + | |
| 8114 | + | |
| 8115 | + | |
| 8116 | + | |
| 8117 | + | |
| 8118 | + | |
| 8119 | + | |
| 8120 | + | |
| 8121 | + | |
| 8122 | + | |
| 8123 | + | |
8094 | 8124 | | |
8095 | 8125 | | |
8096 | 8126 | | |
| |||
0 commit comments