diff options
Diffstat (limited to 'tests/Euler.cpp')
-rw-r--r-- | tests/Euler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/Euler.cpp b/tests/Euler.cpp index d9c6d18..1741dc8 100644 --- a/tests/Euler.cpp +++ b/tests/Euler.cpp @@ -48,8 +48,8 @@ main() << "Expected: " << expected << std::endl << "Iterations: " << integrator.iterations() << std::endl; - double error = std::abs(expected - actual)/expected; - if (error > 0.01) { + double error = std::abs(expected - actual)/std::abs(expected); + if (error > 0.01 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { |