unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 47403605dd59fe78d1bf5ed2d4e81b7acb3114fb 1451 bytes (raw)
name: gnu/packages/patches/fuzzylite-soften-float-equality.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Origin: https://salsa.debian.org/debian/fuzzylite/-/blob/debian/6.0+dfsg-6/debian/patches/when-testing-large-float-numbers-for-equ.patch
From: Johannes 'josch' Schauer <josch@debian.org>
Date: Sun, 3 Feb 2019 10:33:22 +0100
X-Dgit-Generated: 6.0+dfsg-2 80960ae38da9db032dfbfec6405398653e8205ff
Subject: when testing large float numbers for equality, use a larger epsilon


---

--- fuzzylite-6.0+dfsg.orig/fuzzylite/test/BenchmarkTest.cpp
+++ fuzzylite-6.0+dfsg/fuzzylite/test/BenchmarkTest.cpp
@@ -96,7 +96,17 @@ namespace fl {
         CHECK(Op::isEq(1.0, Benchmark::convert(1000.0, Benchmark::MilliSeconds, Benchmark::Seconds)));
         FL_LOG(Benchmark::convert(1000.0, Benchmark::MilliSeconds, Benchmark::Seconds));
 
-        CHECK(Op::isEq(35e9, Benchmark::convert(35, Benchmark::Seconds, Benchmark::NanoSeconds)));
+        scalar eps =
+#ifndef __i386__
+            fuzzylite::macheps();
+#else
+            // on i386, due to the 80bit x87 register, double floating point
+            // numbers are handled differently and thus the difference between
+            // 35e9 and the result of Benchmark::convert() will be 2.179e-6,
+            // which is greater than the default epsilon of 1e-6.
+            1e-5;
+#endif
+        CHECK(Op::isEq(35e9, Benchmark::convert(35, Benchmark::Seconds, Benchmark::NanoSeconds), eps));
         CHECK(Op::isEq(35, Benchmark::convert(35e9, Benchmark::NanoSeconds, Benchmark::Seconds)));
     }
 

debug log:

solving 47403605dd ...
found 47403605dd in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).