summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-angr-fix-manyfloat-tests.patch
blob: 1eda0fbab58c42f86c6bad10db4a1108caf1d161 (plain)
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
See https://github.com/angr/angr/commit/d4a3f058e06a78361b60e08544ea4ae8f735e0cf

diff --git a/tests/factory/test_callable.py b/tests/factory/test_callable.py
index 22602c15e..f6e5e49df 100755
--- a/tests/factory/test_callable.py
+++ b/tests/factory/test_callable.py
@@ -3,6 +3,8 @@ from __future__ import annotations
 
 __package__ = __package__ or "tests.factory"  # pylint:disable=redefined-builtin
 
+import functools
+import operator
 import os
 import unittest
 
@@ -135,7 +137,12 @@ class TestCallable(unittest.TestCase):
         # not almost equal!! totally equal!!! z3 is magic, if kinda slow!!!!!
         for arg_conc in args_conc:
             assert arg_conc > 1.0
-        assert sum(args_conc) == 27.7
+        # Sum sequentially like the program does. Since Python 3.12, builtin
+        # sum() uses Neumaier compensated summation for floats, which is MORE
+        # accurate than the program's naive left-to-right addition and so can
+        # disagree with the (exactly satisfied) symbolic result by an ulp.
+        seq_sum = functools.reduce(operator.add, args_conc)
+        assert seq_sum == 27.7
 
     def test_fauxware_armel(self):
         self.run_fauxware("armel")