[libc-commits] [PATCH] D132842: [libc][math] Added atanf function.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Aug 29 13:36:42 PDT 2022
lntue added inline comments.
================
Comment at: libc/src/__support/FPUtil/FPBits.h:200
+
+ inline static FPBits<T> create_value(bool sign, UIntType unbiased_exp,
+ UIntType mantissa) {
----------------
Please add the same function for `x86_64/LongDoubleBits`
================
Comment at: libc/src/math/generic/atanf.cpp:24
+ if (xbits.is_inf())
+ return opt_barrier(sign ? -M_PI_2 : M_PI_2);
+ else
----------------
Are these constants affected by rounding modes? Also it would be better to define this constant ourselves in some our own header, not relying on the constants defined in `math.h`.
================
Comment at: libc/src/math/generic/atanf.cpp:29
+
+ if (unlikely(xbits.uintval() == 0x3d8d6b23U)) {
+ if (fputil::get_round() == FE_TONEAREST) {
----------------
Add comment about its hexadecimal float value.
================
Comment at: libc/src/math/generic/atanf.cpp:31
+ if (fputil::get_round() == FE_TONEAREST) {
+ FPBits br(0x3d8d31c3U);
+ br.set_sign(sign);
----------------
Add comment about its hexadecimal float value.
================
Comment at: libc/src/math/generic/atanf.cpp:37
+
+ if (unlikely(xbits.uintval() == 0x3feefcfbU)) {
+ int rounding_mode = fputil::get_round();
----------------
Add comment about its hexadecimal float value.
================
Comment at: libc/src/math/generic/atanf.cpp:41
+ if (rounding_mode == FE_DOWNWARD)
+ return FPBits(0xbf8a1f63U).get_val();
+ } else {
----------------
Add comment about its hexadecimal float value.
================
Comment at: libc/src/math/generic/atanf.cpp:44
+ if (rounding_mode == FE_UPWARD)
+ return FPBits(0x3f8a1f63U).get_val();
+ }
----------------
Add comment about its hexadecimal float value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132842/new/
https://reviews.llvm.org/D132842
More information about the libc-commits
mailing list