summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/BS23.cpp4
-rw-r--r--tests/CK45.cpp4
-rw-r--r--tests/Complex.cpp2
-rw-r--r--tests/DP45.cpp4
-rw-r--r--tests/EquationSystem-Vector.cpp2
-rw-r--r--tests/EquationSystem.cpp4
-rw-r--r--tests/Euler.cpp4
-rw-r--r--tests/HE12.cpp4
-rw-r--r--tests/Heun.cpp4
-rw-r--r--tests/Midpoint.cpp4
-rw-r--r--tests/RK4.cpp4
-rw-r--r--tests/RKF45.cpp4
-rw-r--r--tests/Vector.cpp4
13 files changed, 24 insertions, 24 deletions
diff --git a/tests/BS23.cpp b/tests/BS23.cpp
index 8bbcd96..91a5b67 100644
--- a/tests/BS23.cpp
+++ b/tests/BS23.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 > 4.8e-6) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 4.8e-6 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/CK45.cpp b/tests/CK45.cpp
index 0c275df..0d95f67 100644
--- a/tests/CK45.cpp
+++ b/tests/CK45.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 > 2.7e-6) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 2.7e-6 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/Complex.cpp b/tests/Complex.cpp
index 3d290c0..a81deeb 100644
--- a/tests/Complex.cpp
+++ b/tests/Complex.cpp
@@ -53,7 +53,7 @@ main()
<< "Rejections: " << integrator.rejections() << std::endl;
double error = std::abs(expected - actual)/std::abs(expected);
- if (error > 6.0e-7) {
+ if (error > 6.0e-7 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/DP45.cpp b/tests/DP45.cpp
index 6367dc7..237672d 100644
--- a/tests/DP45.cpp
+++ b/tests/DP45.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 > 6.0e-7) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 6.0e-7 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/EquationSystem-Vector.cpp b/tests/EquationSystem-Vector.cpp
index b121026..6ac5ae9 100644
--- a/tests/EquationSystem-Vector.cpp
+++ b/tests/EquationSystem-Vector.cpp
@@ -60,7 +60,7 @@ main()
<< "Rejections: " << integrator.rejections() << std::endl;
double error = norm(expected - actual)/norm(expected);
- if (error > 4.0e-6) {
+ if (error > 4.0e-6 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/EquationSystem.cpp b/tests/EquationSystem.cpp
index 6d83917..309e5f5 100644
--- a/tests/EquationSystem.cpp
+++ b/tests/EquationSystem.cpp
@@ -63,8 +63,8 @@ main()
<< "Iterations: " << integrator.iterations() << std::endl
<< "Rejections: " << integrator.rejections() << std::endl;
- double error = std::abs(expected - actual)/expected;
- if (error > 6.0e-7) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 6.0e-7 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
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 {
diff --git a/tests/HE12.cpp b/tests/HE12.cpp
index 19c5e59..8de11e8 100644
--- a/tests/HE12.cpp
+++ b/tests/HE12.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 > 8.7e-7) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 8.7e-7 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/Heun.cpp b/tests/Heun.cpp
index d4f02bc..6eca969 100644
--- a/tests/Heun.cpp
+++ b/tests/Heun.cpp
@@ -48,8 +48,8 @@ main()
<< "Expected: " << expected << std::endl
<< "Iterations: " << integrator.iterations() << std::endl;
- double error = std::abs(expected - actual)/expected;
- if (error > 1.4e-4) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 1.4e-4 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
diff --git a/tests/Midpoint.cpp b/tests/Midpoint.cpp
index 01c8853..77c7f68 100644
--- a/tests/Midpoint.cpp
+++ b/tests/Midpoint.cpp
@@ -48,8 +48,8 @@ main()
<< "Expected: " << expected << std::endl
<< "Iterations: " << integrator.iterations() << std::endl;
- double error = std::abs(expected - actual)/expected;
- if (error > 1.4e-4) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 1.4e-4 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
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 {
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 {
diff --git a/tests/Vector.cpp b/tests/Vector.cpp
index 688f826..9f22a6f 100644
--- a/tests/Vector.cpp
+++ b/tests/Vector.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.5e-6) {
+ double error = std::abs(expected - actual)/std::abs(expected);
+ if (error > 1.5e-6 || !std::isfinite(error)) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {