From 3f041add6b1a9aba045cc01da37a3361fddf1712 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 13 Sep 2017 12:49:30 +0100 Subject: [PATCH] Do not use eps=0 in the gravity derivative unit test. That leads to FPEs when running without optimizations. --- tests/testGravityDerivatives.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testGravityDerivatives.c b/tests/testGravityDerivatives.c index 0a811cbda4..77240f397e 100644 --- a/tests/testGravityDerivatives.c +++ b/tests/testGravityDerivatives.c @@ -952,10 +952,13 @@ int main() { /* Compute distance */ const double r2 = dx * dx + dy * dy + dz * dz; const double r_inv = 1. / sqrt(r2); + const double r = r2 * r_inv; + const double eps = r / 10.; + const double eps_inv = 1. / eps; /* Compute all derivatives */ struct potential_derivatives_M2L pot; - compute_potential_derivatives_M2L(dx, dy, dz, r2, r_inv, 0., FLT_MAX, &pot); + compute_potential_derivatives_M2L(dx, dy, dz, r2, r_inv, eps, eps_inv, &pot); /* Minimal value we care about */ const double min = 1e-9; -- GitLab