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