diff options
Diffstat (limited to 'tests/validation/FixedPoint.h')
-rw-r--r-- | tests/validation/FixedPoint.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/validation/FixedPoint.h b/tests/validation/FixedPoint.h index 380bad04a1..fa99ff84c2 100644 --- a/tests/validation/FixedPoint.h +++ b/tests/validation/FixedPoint.h @@ -756,8 +756,9 @@ struct functions fixed_point<T> a = shift < 0 ? shift_left(x, -shift) : shift_right(x, shift); const fixed_point<T> x_half = shift_right(a, 1); - // We need three iterations to find the result - for(int i = 0; i < 3; ++i) + // We need three iterations to find the result for QS8 and five for QS16 + constexpr int num_iterations = std::is_same<T, int8_t>::value ? 3 : 5; + for(int i = 0; i < num_iterations; ++i) { a = mul(a, sub(three_half, mul(x_half, mul(a, a)))); } |