[PATCH v2 0/1] MR10555: gdiplus/tests: Fix flaky rounding error in test_getblend.
The sentinel value 0xdeadbeef (3735928559) exceeds the 24-bit mantissa precision of a 32-bit float. On some architectures (like i386 using x87 FPU), comparisons between register-stored constants and memory-stored floats would fail due to inconsistent rounding. Replaced the sentinel with 12345.0, which can be represented exactly in a 32-bit float, ensuring deterministic test results across different floating-point units. -- v2: gdiplus/tests: Fix flaky rounding error in test_getblend. https://gitlab.winehq.org/wine/wine/-/merge_requests/10555
From: Bartosz Kosiorek <gang65@poczta.onet.pl> The sentinel value 0xdeadbeef (3735928559) exceeds the 24-bit mantissa precision of a 32-bit float. On some architectures (like i386 using x87 FPU), comparisons between register-stored constants and memory-stored floats would fail due to inconsistent rounding. Replaced the sentinel with 12345.0, which can be represented exactly in a 32-bit float, ensuring deterministic test results across different floating-point units. --- dlls/gdiplus/tests/brush.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c index ad2712fae34..50ebda6aaa8 100644 --- a/dlls/gdiplus/tests/brush.c +++ b/dlls/gdiplus/tests/brush.c @@ -202,12 +202,14 @@ static void test_getblend(void) status = GdipGetPathGradientBlend(NULL, NULL, NULL, 1); expect(InvalidParameter, status); - blends[0] = (REAL)0xdeadbeef; - pos[0] = (REAL)0xdeadbeef; + /* 12345.0f fits perfectly within the 24-bit mantissa of an IEEE 754 32-bit float, + avoiding x87 vs SSE rounding discrepancies */ + blends[0] = 12345.0f; + pos[0] = 12345.0f; status = GdipGetPathGradientBlend(brush, blends, pos, 1); expect(Ok, status); expectf(1.0, blends[0]); - expectf((REAL)0xdeadbeef, pos[0]); + expectf(12345.0f, pos[0]); GdipDeleteBrush((GpBrush*) brush); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10555
This merge request was approved by Esme Povirk. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10555
participants (3)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65) -
Esme Povirk (@madewokherd)