From c06d53c6c0fe261fcf227d96ff73361818c2d2ec Mon Sep 17 00:00:00 2001 From: Guilherme Amadio Date: Tue, 11 Apr 2017 11:48:00 +0200 Subject: [PATCH] Use tolerance to compare floating point numbers The exact comparison fails in some architectures where rounding may occur. --- math/genvector/test/testGenVector.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/math/genvector/test/testGenVector.cxx b/math/genvector/test/testGenVector.cxx index 76a7c09dec1c5..2257c52e4fa31 100644 --- a/math/genvector/test/testGenVector.cxx +++ b/math/genvector/test/testGenVector.cxx @@ -701,7 +701,9 @@ int testTransform3D() { Transform3D tr(EulerAngles(10, -10, 10), XYZVector(10, -10, 0)); auto r1 = tr.ApplyInverse(vector); auto r2 = tr.Inverse()(vector); - iret |= compare((r1 == r2), true, "ApplyInverse/Vector"); + iret |= compare(r1.X(), r2.X(), "ApplyInverse/Vector", 10); + iret |= compare(r1.Y(), r2.Y(), "ApplyInverse/Vector", 10); + iret |= compare(r1.Z(), r2.Z(), "ApplyInverse/Vector", 10); } if (iret == 0) std::cout << "OK\n";