summaryrefslogtreecommitdiffstats
path: root/tests/RK4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/RK4.cpp')
-rw-r--r--tests/RK4.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/RK4.cpp b/tests/RK4.cpp
index 71a998c..9edeb1c 100644
--- a/tests/RK4.cpp
+++ b/tests/RK4.cpp
@@ -48,8 +48,8 @@ main()
<< "Expected: " << expected << std::endl
<< "Iterations: " << integrator.iterations() << std::endl;
- double error = std::abs(expected - actual)/expected;
- if (error > 4.2e-8) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 4.2e-8 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {