[PATCH 0/1] MR11085: webservices: Improve double tests.
The [test pattern page](https://test.winehq.org/data/patterns.html#webservices:writer) shows since yesterday failures for the linux 32-bit tests. In my debugging the `digit` variable holds a value of 10, therefore the `*(p++) = '0' + digit;` results in the wrong colon in `<t>:E-3</t>`. I could not reproduce the working state at my system of the previous commit round, therefore could not start a git bisect. What makes me wonder is, my [asan gitlab CI runs](https://gitlab.winehq.org/bernhardu/wine/-/jobs/229031#L4063) with llvm-mingw/clang started to show this issue already at 2026-02-13. Could probably the patch 508a30f0d3, "configure: Add -msse2 to default i386_EXTRACFLAGS.", made this issue to surface in the various test runs? However, this patch makes the failing tests succeed. Unfortunately I found some new values, which have rounding issues in 64 and 32 bits. [Testbot run with this patch](https://testbot.winehq.org/JobDetails.pl?Key=163276). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11085
From: Bernhard Übelacker <bernhardu@mailbox.org> --- dlls/webservices/tests/writer.c | 17 ++++++++++++----- dlls/webservices/writer.c | 3 +-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c index 8e83707c3cf..1a08321e200 100644 --- a/dlls/webservices/tests/writer.c +++ b/dlls/webservices/tests/writer.c @@ -2230,6 +2230,7 @@ static void test_double(void) double val; const char *result; BOOL todo64; + BOOL todo32; } tests[] = { @@ -2241,11 +2242,15 @@ static void test_double(void) {1.0000000000000003, "<t>1.0000000000000002</t>"}, {1.0000000000000004, "<t>1.0000000000000004</t>"}, {100000000000000, "<t>100000000000000</t>"}, + {-100000000000000, "<t>-100000000000000</t>"}, {1000000000000000, "<t>1E+15</t>"}, - {0.1, "<t>0.1</t>", TRUE}, - {0.01, "<t>1E-2</t>", TRUE}, - {-0.1, "<t>-0.1</t>", TRUE}, - {-0.01, "<t>-1E-2</t>", TRUE}, + {-1000000000000000, "<t>-1E+15</t>"}, + {0.1, "<t>0.1</t>"}, + {-0.1, "<t>-0.1</t>"}, + {0.01, "<t>1E-2</t>"}, + {-0.01, "<t>-1E-2</t>"}, + {9.9, "<t>9.9</t>", TRUE, TRUE}, + {-9.9, "<t>-9.9</t>", TRUE, TRUE}, {1.7976931348623158e308, "<t>1.7976931348623157E+308</t>", TRUE}, {-1.7976931348623158e308, "<t>-1.7976931348623157E+308</t>", TRUE}, }; @@ -2260,6 +2265,7 @@ static void test_double(void) text.text.textType = WS_XML_TEXT_TYPE_DOUBLE; for (i = 0; i < ARRAY_SIZE( tests ); i++) { + winetest_push_context("i=%ld expected=%s", i, tests[i].result); hr = set_output( writer ); ok( hr == S_OK, "got %#lx\n", hr ); hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL ); @@ -2271,7 +2277,7 @@ static void test_double(void) hr = WsWriteEndElement( writer, NULL ); ok( hr == S_OK, "%lu: got %#lx\n", i, hr ); - if (tests[i].todo64 && is_win64) + if ((tests[i].todo64 && is_win64) || (tests[i].todo32 && !is_win64)) { WS_BYTES bytes; ULONG size = sizeof(bytes); @@ -2287,6 +2293,7 @@ static void test_double(void) debugstr_bytes(bytes.bytes, bytes.length), len, tests[i].result ); } else check_output( writer, tests[i].result, __LINE__ ); + winetest_pop_context(); } hr = set_output( writer ); diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index df8535f8647..9619b562c05 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -926,10 +926,9 @@ static ULONG format_double( const double *ptr, unsigned char *buf ) } mag = log10( val ); - use_exp = (mag >= 15 || (neg && mag >= 1) || mag <= -1); + use_exp = (mag >= 15 || mag < -1); if (use_exp) { - if (mag < 0) mag -= 1; val = val / pow( 10.0, mag ); mag2 = mag; mag = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11085
Yes, it's likely caused by the -msse2 flag. Note that the failing cases are now the same as on 64-bit. I would suggest to rename todo64 to todo instead and not touch the implementation at this point. Before the switch to PE we used the native long double type (80 bit) which gives sufficient precision to make the tests pass. The implementation should probably be rewritten to use SSE/NEON instructions with a 128 bit type. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11085#note_142402
On Mon Jun 8 17:44:22 2026 +0000, Hans Leidekker wrote:
Yes, it's likely caused by the -msse2 flag. Note that the failing cases are now the same as on 64-bit. I would suggest to rename todo64 to todo instead and not touch the implementation at this point. Before the switch to PE we used the native long double type (80 bit) which gives sufficient precision to make the tests pass. The implementation should probably be rewritten to use SSE/NEON instructions with a 128 bit type. Thanks for taking a look.
I did not combine the todo for 32- and 64-bits because at least testbot shows the test "<t>1.7976931348623157E+308</t>" is working at 64-bit but fails with 32-bit: https://testbot.winehq.org/JobDetails.pl?Key=163285 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11085#note_142427
On Mon Jun 8 17:44:21 2026 +0000, Bernhard Übelacker wrote:
Thanks for taking a look. I did not combine the todo for 32- and 64-bits because at least testbot shows the test "<t>1.7976931348623157E+308</t>" is working at 64-bit but fails with 32-bit: https://testbot.winehq.org/JobDetails.pl?Key=163285 So this also depends on the compiler. What about this patch? Now we just need to remember to remove todo from this test when Wine is fixed ;-) [webservices_tests.diff](/uploads/35aab79ebc61a902adbcb7600596452e/webservices_tests.diff)
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/11085#note_142431
participants (3)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu) -
Hans Leidekker (@hans)