Replace patch for #1050076 with the version accepted upstream
authorSimon McVittie <smcv@debian.org>
Tue, 22 Aug 2023 18:26:55 +0000 (19:26 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 22 Aug 2023 18:28:05 +0000 (19:28 +0100)
This accepts slight numerical differences on all platforms, not just i386.

debian/patches/series
debian/patches/tests-Accept-slightly-different-numeric-results-on-i386.patch [deleted file]
debian/patches/tests-Accept-slightly-different-numeric-results.patch [new file with mode: 0644]

index cd5302f2104890d699c014ec9760e42c7da0b815..61cb9dd3b6d24896d02d676a063e5477a12910d4 100644 (file)
@@ -1,4 +1,4 @@
-tests-Accept-slightly-different-numeric-results-on-i386.patch
+tests-Accept-slightly-different-numeric-results.patch
 Revert-tests-Stop-copying-the-tool-tests.patch
 Revert-build-Drop-the-install-tests-option.patch
 print-Revert-Start-sorting-apart-includes-change-for-gtkp.patch
diff --git a/debian/patches/tests-Accept-slightly-different-numeric-results-on-i386.patch b/debian/patches/tests-Accept-slightly-different-numeric-results-on-i386.patch
deleted file mode 100644 (file)
index e164e6c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-From: Simon McVittie <smcv@debian.org>
-Date: Tue, 22 Aug 2023 10:49:36 +0100
-Subject: tests: Accept slightly different numeric results on i386
-
-When using the legacy i387 FPU, 80-bit extended precision can result in
-slightly different answers for a floating-point computation that ought
-to be exact, depending on whether it was done in registers or saved
-and loaded to/from memory. Apparently in 1987 this seemed like a good
-idea.
-
-Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/6051
-Bug-Debian: https://bugs.debian.org/1050076
-Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6320
----
- testsuite/gtk/colorutils.c | 22 ++++++++++++++++------
- 1 file changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/testsuite/gtk/colorutils.c b/testsuite/gtk/colorutils.c
-index b4d42e2..8260674 100644
---- a/testsuite/gtk/colorutils.c
-+++ b/testsuite/gtk/colorutils.c
-@@ -30,6 +30,16 @@ struct {
-   { 1, 0, 1, 5.0 / 6.0, 1, 1 },
- };
-+/* When using the legacy i387 FPU, 80-bit extended precision can result in
-+ * slightly different answers for a floating-point computation that ought
-+ * to be exact, depending on whether it was done in registers or saved
-+ * and loaded to/from memory. */
-+#ifdef __i386__
-+#define EPSILON 1e-6
-+#else
-+#define EPSILON FLT_EPSILON
-+#endif
-+
- static void
- test_roundtrips (void)
- {
-@@ -40,13 +50,13 @@ test_roundtrips (void)
-       g_print ("color %u\n", i);
-       gtk_hsv_to_rgb (tests[i].h, tests[i].s, tests[i].v, &r, &g, &b);
--      g_assert_cmpfloat_with_epsilon (r, tests[i].r, FLT_EPSILON);
--      g_assert_cmpfloat_with_epsilon (g, tests[i].g, FLT_EPSILON);
--      g_assert_cmpfloat_with_epsilon (b, tests[i].b, FLT_EPSILON);
-+      g_assert_cmpfloat_with_epsilon (r, tests[i].r, EPSILON);
-+      g_assert_cmpfloat_with_epsilon (g, tests[i].g, EPSILON);
-+      g_assert_cmpfloat_with_epsilon (b, tests[i].b, EPSILON);
-       gtk_rgb_to_hsv (tests[i].r, tests[i].g, tests[i].b, &h, &s, &v);
--      g_assert_cmpfloat_with_epsilon (h, tests[i].h, FLT_EPSILON);
--      g_assert_cmpfloat_with_epsilon (s, tests[i].s, FLT_EPSILON);
--      g_assert_cmpfloat_with_epsilon (v, tests[i].v, FLT_EPSILON);
-+      g_assert_cmpfloat_with_epsilon (h, tests[i].h, EPSILON);
-+      g_assert_cmpfloat_with_epsilon (s, tests[i].s, EPSILON);
-+      g_assert_cmpfloat_with_epsilon (v, tests[i].v, EPSILON);
-     }
- }
diff --git a/debian/patches/tests-Accept-slightly-different-numeric-results.patch b/debian/patches/tests-Accept-slightly-different-numeric-results.patch
new file mode 100644 (file)
index 0000000..48a9e96
--- /dev/null
@@ -0,0 +1,54 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Tue, 22 Aug 2023 10:49:36 +0100
+Subject: tests: Accept slightly different numeric results
+
+FLT_EPSILON is the distance between 1.0 and the next distinct floating
+point number, and doesn't necessarily have anything to do with the
+precision we can expect from a series of floating-point calculations.
+Experimentally, 1e-6 is achievable, even on platforms with unusual
+floating point implementations like i387.
+
+Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/6051
+Bug-Debian: https://bugs.debian.org/1050076
+Signed-off-by: Simon McVittie <smcv@debian.org>
+Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6320
+Appled-upstream: 4.13.0, commit:0f125aad90742582c3467640abb291ce4feea7dd
+---
+ testsuite/gtk/colorutils.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/testsuite/gtk/colorutils.c b/testsuite/gtk/colorutils.c
+index b4d42e2..8f0acfb 100644
+--- a/testsuite/gtk/colorutils.c
++++ b/testsuite/gtk/colorutils.c
+@@ -30,6 +30,10 @@ struct {
+   { 1, 0, 1, 5.0 / 6.0, 1, 1 },
+ };
++/* Close enough for float precision to match, even with some
++ * rounding errors */
++#define EPSILON 1e-6
++
+ static void
+ test_roundtrips (void)
+ {
+@@ -40,13 +44,13 @@ test_roundtrips (void)
+       g_print ("color %u\n", i);
+       gtk_hsv_to_rgb (tests[i].h, tests[i].s, tests[i].v, &r, &g, &b);
+-      g_assert_cmpfloat_with_epsilon (r, tests[i].r, FLT_EPSILON);
+-      g_assert_cmpfloat_with_epsilon (g, tests[i].g, FLT_EPSILON);
+-      g_assert_cmpfloat_with_epsilon (b, tests[i].b, FLT_EPSILON);
++      g_assert_cmpfloat_with_epsilon (r, tests[i].r, EPSILON);
++      g_assert_cmpfloat_with_epsilon (g, tests[i].g, EPSILON);
++      g_assert_cmpfloat_with_epsilon (b, tests[i].b, EPSILON);
+       gtk_rgb_to_hsv (tests[i].r, tests[i].g, tests[i].b, &h, &s, &v);
+-      g_assert_cmpfloat_with_epsilon (h, tests[i].h, FLT_EPSILON);
+-      g_assert_cmpfloat_with_epsilon (s, tests[i].s, FLT_EPSILON);
+-      g_assert_cmpfloat_with_epsilon (v, tests[i].v, FLT_EPSILON);
++      g_assert_cmpfloat_with_epsilon (h, tests[i].h, EPSILON);
++      g_assert_cmpfloat_with_epsilon (s, tests[i].s, EPSILON);
++      g_assert_cmpfloat_with_epsilon (v, tests[i].v, EPSILON);
+     }
+ }