[libc-commits] [PATCH] D82036: [libc] Add implementations long double fabsl and truncl functions.
Anthony Steinhauser via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Jun 17 22:07:46 PDT 2020
asteinhauser accepted this revision.
asteinhauser added a comment.
This revision is now accepted and ready to land.
Clang-tidy went completely crazy, or those warnings are expected?
Have you tested it in Visual Studio?
================
Comment at: libc/test/src/math/fabsl_test.cpp:29
+ EXPECT_TRUE(FPBits::inf() == __llvm_libc::fabsl(FPBits::negInf()));
+}
+
----------------
fabsl(NaN) == NaN test would be handy.
================
Comment at: libc/test/src/math/truncl_test.cpp:28
+ EXPECT_TRUE(FPBits::inf() == __llvm_libc::truncl(FPBits::inf()));
+ EXPECT_TRUE(FPBits::negInf() == __llvm_libc::truncl(FPBits::negInf()));
+}
----------------
truncl(NaN) == NaN test
================
Comment at: libc/test/src/math/truncl_test.cpp:37
+ EXPECT_TRUE(FPBits(1234.0l) == __llvm_libc::truncl(1234.0l));
+ EXPECT_TRUE(FPBits(-1234.0l) == __llvm_libc::truncl(-1234.0l));
+}
----------------
Add some test where truncl(x) != x, e.g. truncl(2.5) == 2.0.
================
Comment at: libc/utils/FPUtil/FPBits.h:34
+};
+template <> struct ExponentWidth<long double> {
+ static constexpr unsigned value = 15;
----------------
This should be moved to MantissaWidth<long double> (10 lines below) if for visual studio long double and double are equivalent. You can hardly have 15 bytes for exponent and 52 bits for mantissa.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82036/new/
https://reviews.llvm.org/D82036
More information about the libc-commits
mailing list