[libc-commits] [libc] 5df182f - [libc] disable printf Lf tests for float128 plats
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Thu Jun 8 14:36:12 PDT 2023
Author: Michael Jones
Date: 2023-06-08T14:35:51-07:00
New Revision: 5df182f121ce483ba9050cd8e7c9c9a48757b1e5
URL: https://github.com/llvm/llvm-project/commit/5df182f121ce483ba9050cd8e7c9c9a48757b1e5
DIFF: https://github.com/llvm/llvm-project/commit/5df182f121ce483ba9050cd8e7c9c9a48757b1e5.diff
LOG: [libc] disable printf Lf tests for float128 plats
The results for the %Lf tests were calculated on 80 bit long double
systems, meaning the results are not necessarily accurate for float128
systems. In future these will be fixed, but for the moment I'm just
turning them off.
Differential Revision: https://reviews.llvm.org/D152471
Added:
Modified:
libc/test/src/stdio/sprintf_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index e6628eecd8289..9fb7705334046 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -928,12 +928,16 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// Length Modifier Tests.
- // TODO: Fix long doubles (needs bigger table or alternate algorithm.)
- // Currently the table values are generated, which is very slow.
+ // TODO(michaelrj): Add tests for LONG_DOUBLE_IS_DOUBLE and 128 bit long
+ // double systems.
+ // TODO(michaelrj): Fix the tests to only depend on the digits the long double
+ // is accurate for.
written = __llvm_libc::sprintf(buff, "%Lf", 1.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000");
+#if defined(SPECIAL_X86_LONG_DOUBLE)
+
written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);
ASSERT_STREQ_LEN(written, buff,
"99999999999999999996693535322073426194986990198284960792713"
@@ -941,8 +945,6 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
char big_buff[10000];
- // written = __llvm_libc::sprintf(big_buff, "%Lf", 0x1p16383L);
-
written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L);
ASSERT_STREQ_LEN(
written, big_buff,
@@ -1035,10 +1037,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"231934194956788626761834746430104077432547436359522462253411168467463134"
"24896.000000");
-
written = __llvm_libc::sprintf(big_buff, "%.10Lf", 1e-10L);
- ASSERT_STREQ_LEN(
- written, big_buff, "0.0000000001");
+ ASSERT_STREQ_LEN(written, big_buff, "0.0000000001");
written = __llvm_libc::sprintf(big_buff, "%.7500Lf", 1e-4900L);
ASSERT_STREQ_LEN(
@@ -1149,6 +1149,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"570449525088342437216896462077260223998756027453411520977536701491759878"
"422771447006016890777855573925295187921971811871399320142563330377888532"
"179817332113");
+#endif // SPECIAL_X86_LONG_DOUBLE
/*
written = __llvm_libc::sprintf(buff, "%La", 0.1L);
More information about the libc-commits
mailing list