<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96322>96322</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc][math] implement `signbit`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
https://android-review.googlesource.com/c/platform/bionic/+/3141224/1/libc/include/math.h demonstrates that `__builtin_signbit` can be used to implement this macro (or a few fallbacks in case this builtin isn't available). We should use godbolt.org to figure out what compilers and compiler versions support this macro.
I would put these in libc/include/llvm-libc-macros/math-macros.h (there's a comment at the bottom to start a new header for these).
It seems that we don't have tests for `isfinite`, `isinf`, or `isnan` macros from our math.h, which is problematic. We should start a new "include" test under libc/test/include (similar to stdbit_test.cpp).
cc @lntue
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxklEuO4zgMhk8jb4gyHPqRZOFFVxcCzAlmGehB25yWJUOPBHP7gex0V3XPxgBlivz4k5SMkWdHNIr-XfQflcxp8WF0rH8YijJbxxRipbz5d1xS2qJovwm8CbxJZ4Jn8xbowfSsZ-9nS9HnoKnWfhV40wJvm5Vp8qGYir1jvV9-F3hrT90JsRN4Owm8WVblFzttsyGBt1WmpV7A0OpdTEEmipAWmUAMzf2uMtvE7l7gFScxNKClA0WQIxlIHnjdLK3kEqSFI6xSBw8CLz6AhImeMElrldQ_IrADLSMdjq_IwNEJPCeQD8lWKksCrzXA3wRx8dmakghmb5S3qfZhLjknnnMg8DnBs6Bqv25sKUSQzvyy4EEhsncRYt42H74S1qL5EM234_sXPPdMWy4uFKmQ_k8oax_rWzl92yPEl3Yvq15K0WmhQALPEWTB2GWRe1BQPiW_FvqYZEggwdETFpKGAkw-HJlL8b-hJYhE66slTwLjD7kW-SBIFFPcL4uh4Tix40RiaAR-P07YTS_zp4-TrjTxgIYp-BV8DnBMQXF8LqwX4Ahb8MrSKhPr3_rxFV8g_hIIdxzIrhT0Uq-cfIpYFIq8spXh0MEoTvfiU-tt-7N0rUF0jXUpE1RmbM21vcqKxtP5dLleery01TJekXSH2KgeL4idPJnzoKfz1EqllbzqikdssGsGPJ36vuvaur3QcFHD9dzj2XQDiq6hVbKtS3_LgFUcY6bxOrSIlZWKbNyXFnH23sDEISbYfQSiwO8C8agWy16HcZ8TledY6Dmm-Bk5cbL7C7Bf6D9E_16EF_3HlzUSQ_O5bVUO9o_3YOa0ZPVa_RL652xuwf9Dete70JUBPYp4jPhfAAAA__9xBXwF">