[libc-commits] [libc] [libc] fix error: implicit conversion loses floating-point precision: 'double' to 'float' in shared_math_test.cpp (PR #159934)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Sat Sep 20 09:37:04 PDT 2025
================
@@ -57,7 +57,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
EXPECT_FP_EQ(0x1p+0f, LIBC_NAMESPACE::shared::cosf(0.0f));
EXPECT_FP_EQ(0x1p+0f, LIBC_NAMESPACE::shared::coshf(0.0f));
EXPECT_FP_EQ(0x1p+0f, LIBC_NAMESPACE::shared::cospif(0.0f));
- EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::dsqrtl(0.0f));
+ EXPECT_FP_EQ(0x0p+0f, (float)LIBC_NAMESPACE::shared::dsqrtl(0.0f));
----------------
jhuber6 wrote:
Either just use the double constant without the `f` or use a C++ cast.
https://github.com/llvm/llvm-project/pull/159934
More information about the libc-commits
mailing list