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