diff --git a/frontends/concrete-python/tests/execution/test_round_bit_pattern.py b/frontends/concrete-python/tests/execution/test_round_bit_pattern.py index deaf41031b..49c0401e86 100644 --- a/frontends/concrete-python/tests/execution/test_round_bit_pattern.py +++ b/frontends/concrete-python/tests/execution/test_round_bit_pattern.py @@ -703,7 +703,11 @@ def function(x): # check it's better even with bad conf assert circuit_approx.complexity < circuit_exact.complexity - testset = range(*inputset) + # avoiding overflows + if signed: + testset = [-(2 ** (accumulator_precision - 1)), 2 ** (accumulator_precision - 1) - 2**lsbs_to_remove] + else: + testset = [0, 2**accumulator_precision - 2**lsbs_to_remove] nb_error = 0 for x in testset: @@ -711,8 +715,8 @@ def function(x): approx_simu = circuit_approx.simulate(x) exact = circuit_exact.simulate(x) assert abs(approx_simu - exact) <= 1 - assert abs(approx_simu - approx) <= 1 - delta = abs(approx - approx_simu) + assert abs(approx - exact) <= 1 + delta = abs(approx - exact) assert delta <= 1 nb_error += delta > 0