<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61092>61092</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] Correct edge cases, errno, and floating point exceptions for math functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc,
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
lntue
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lntue
</td>
</tr>
</table>
<pre>
There are many cases of math functions not returning correct errno and floating point exceptions according to the C standard. The following cases are reported by Fred J. Tydeman:
- `log(1) = -0` for `FE_DOWNWARD`
- `logb(0)` is not raising divide-by-zero
- `sqrt(-infinity)` => missing errno == EDOM
- `fmod(-NAN,-NAN) = +NAN`
- `remainder(-infinity, -infinity)` => no invalid
- `nextafter(-max, -infinity)` => no overflow, no inexact
- `fdim(-inf, -inf)` => invalid (should be no FP exception)
- `fdim(-max, -den)` => inexact (should be no FP exception)
- `fma( -min, +min, +min )` => missing underflow
- `asinf()` issue: no inexact
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlE-PszYQxj-NuYyIzBAIOXDIhuVQqftW1UrvsTJ4CK6Mndomm_TTVyZJN-mfld6Tje35-ZlhHgvv1cEQ1ax4YYjahJkYIiuaRMxhtK5elpLOykv9PpIjEI5gEuYCvfDkwQ4wiTDCMJs-KGs8GBvAUZidUeYAvXWO-gDknLEgjIRBWxHi1tEqE4DOPR2vkaLvrZNxK1gII8EefBBGCidXAO8jwWC1th8Ld7k9inF0tC6QhO4CrSMJP63g_SJpEoblO8YbxncpsJJre2BYZQy3wPIGUs5KDoN1ca99_a359v3t--7XhpX8OahjWHGG23hc3fITykcVUp2UpLS7pH-Ssw9h_g8XGFapMoMyKlxu4SxvWP4Kk_JL-LUoy2IDr823nx8Iw2RlJLzt3hjur8NVOMOX-PUk09EklJHkni_dw_8oMBaUOQmt5APE0DmIIVwhkzh_HW9P5AZtP-KpBUdn0YfHDKSabnLupGfITQEwrPxoZy2ho4hqf_nsihjxb-RdnCTzT-Si4keQk2BYQTopE5EMX55m8N9_bo61XrL_JAm_ZFj93Sp-JpbvHoqTyDqX23wrEqqzcrMpq3WBPBnrqizyNd-g4FVRZBnmvBvKvBrWKCu5WZeJqpFjznOeZQVWa77CQoht13X9duCbPtuwNY8toFdan6aVdYdkub8uM77FRIuOtL-7XHV9NDnuGaKhj5vSq-1dHQFpNx88W3OtfPCfyKCCXt6KBVE0sL-7Wx7oaslYuaWt4-Rru0frPb8dyex0PYZw9NG52DJsDyqMc7fq7cSwjUJuQ3p09nfqA8N2ke8ZtkuufwUAAP__M216DQ">