1 Fix FTBFS on i686-linux due to rounding issue (see references).
3 Fixes Guix bug #22049 (see below).
8 https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBoxAlgo.patch/
9 https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBox.patch/
12 https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html
13 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22049
14 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815712
15 https://anonscm.debian.org/cgit/pkg-phototools/ilmbase.git/commit/?id=ab28bb45cdad8adc32e345b777ab8e692b1d9a9c
19 Subject: testBoxAlgo: allow fuzzy match of b12 == b2
20 From: Steven Chamberlain <steven@pyro.eu.org>
21 Date: Wed, 24 Feb 2016 01:04:11 +0000
23 Also fix a pre-existing typo.
25 --- a/IlmBase/ImathTest/testBoxAlgo.cpp
26 +++ b/IlmBase/ImathTest/testBoxAlgo.cpp
27 @@ -886,10 +886,11 @@ boxMatrixTransform ()
29 assert (approximatelyEqual (b2.min, b4.min, e));
30 assert (approximatelyEqual (b2.max, b4.max, e));
31 - assert (approximatelyEqual (b3.max, b4.max, e));
32 + assert (approximatelyEqual (b3.min, b4.min, e));
33 assert (approximatelyEqual (b3.max, b4.max, e));
36 + assert (approximatelyEqual (b2.min, b21.min, e));
37 + assert (approximatelyEqual (b2.max, b21.max, e));
44 Subject: testBox: allow fuzzy comparison of floats, doubles
45 From: Steven Chamberlain <steven@pyro.eu.org>
46 Date: Wed, 24 Feb 2016 01:10:11 +0000
48 Allow for inexact values, as long as the error is smaller than the
49 epsilon of the data type.
51 On 32-bit x86, allow even greater discrepency at double
52 precision, due to possible double-rounding. See
53 https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html
55 --- a/IlmBase/ImathTest/testBox.cpp
56 +++ b/IlmBase/ImathTest/testBox.cpp
57 @@ -47,6 +47,58 @@ using namespace IMATH_INTERNAL_NAMESPACE
63 +approximatelyEqual (const T &p1, const T &p2)
65 + /* int and short should be exact */
70 +approximatelyEqual (const Vec2<float> &p1, const Vec2<float> &p2)
72 + float e = limits<float>::epsilon();
75 + for (int i = 0; i < 2; ++i)
77 + m = max (m, abs (p1[i]));
78 + m = max (m, abs (p2[i]));
81 + for (int i = 0; i < 2; ++i)
82 + if (!equalWithAbsError (p1[i], p2[i], m * e))
89 +approximatelyEqual (const Vec2<double> &p1, const Vec2<double> &p2)
91 +#if defined(__i386__) || defined(_M_IX86)
92 + /* double-rounding on 32-bit x86 may cause larger error:
93 + use epsilon of float rather than double */
94 + double e = limits<float>::epsilon();
96 + double e = limits<double>::epsilon();
100 + for (int i = 0; i < 2; ++i)
102 + m = max (m, abs (p1[i]));
103 + m = max (m, abs (p2[i]));
106 + for (int i = 0; i < 2; ++i)
107 + if (!equalWithAbsError (p1[i], p2[i], m * e))
114 // Test case generation utility - create a vector of IMATH_INTERNAL_NAMESPACE::Vec{2,3,4}
115 // with all permutations of integers 1..T::dimensions().
116 @@ -250,7 +302,8 @@ testExtendByPoint(const char *type)
118 IMATH_INTERNAL_NAMESPACE::Box<T> b;
120 - assert(b.min == p && b.max == p);
121 + assert (approximatelyEqual (b.min, p));
122 + assert (approximatelyEqual (b.max, p));
126 @@ -283,7 +336,8 @@ testExtendByPoint(const char *type)
130 - assert(b.min == min && b.max == max);
131 + assert (approximatelyEqual (b.min, min));
132 + assert (approximatelyEqual (b.max, max));
136 @@ -358,7 +412,8 @@ testExtendByBox(const char *type)
138 b.extendBy(IMATH_INTERNAL_NAMESPACE::Box<T>(p0, p1));
140 - assert(b.min == min && b.max == max);
141 + assert (approximatelyEqual (b.min, min));
142 + assert (approximatelyEqual (b.max, max));