Skip to content

Commit 5df182f

Browse files
[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
1 parent 688b973 commit 5df182f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libc/test/src/stdio/sprintf_test.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -928,21 +928,23 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
928928

929929
// Length Modifier Tests.
930930

931-
// TODO: Fix long doubles (needs bigger table or alternate algorithm.)
932-
// Currently the table values are generated, which is very slow.
931+
// TODO(michaelrj): Add tests for LONG_DOUBLE_IS_DOUBLE and 128 bit long
932+
// double systems.
933+
// TODO(michaelrj): Fix the tests to only depend on the digits the long double
934+
// is accurate for.
933935

934936
written = __llvm_libc::sprintf(buff, "%Lf", 1.0L);
935937
ASSERT_STREQ_LEN(written, buff, "1.000000");
936938

939+
#if defined(SPECIAL_X86_LONG_DOUBLE)
940+
937941
written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);
938942
ASSERT_STREQ_LEN(written, buff,
939943
"99999999999999999996693535322073426194986990198284960792713"
940944
"91541752018669482644324418977840117055488.000000");
941945

942946
char big_buff[10000];
943947

944-
// written = __llvm_libc::sprintf(big_buff, "%Lf", 0x1p16383L);
945-
946948
written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L);
947949
ASSERT_STREQ_LEN(
948950
written, big_buff,
@@ -1035,10 +1037,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
10351037
"231934194956788626761834746430104077432547436359522462253411168467463134"
10361038
"24896.000000");
10371039

1038-
10391040
written = __llvm_libc::sprintf(big_buff, "%.10Lf", 1e-10L);
1040-
ASSERT_STREQ_LEN(
1041-
written, big_buff, "0.0000000001");
1041+
ASSERT_STREQ_LEN(written, big_buff, "0.0000000001");
10421042

10431043
written = __llvm_libc::sprintf(big_buff, "%.7500Lf", 1e-4900L);
10441044
ASSERT_STREQ_LEN(
@@ -1149,6 +1149,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
11491149
"570449525088342437216896462077260223998756027453411520977536701491759878"
11501150
"422771447006016890777855573925295187921971811871399320142563330377888532"
11511151
"179817332113");
1152+
#endif // SPECIAL_X86_LONG_DOUBLE
11521153

11531154
/*
11541155
written = __llvm_libc::sprintf(buff, "%La", 0.1L);

0 commit comments

Comments
 (0)