commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r812871 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java
Date Wed, 09 Sep 2009 10:11:16 GMT
Author: sebb
Date: Wed Sep  9 10:11:15 2009
New Revision: 812871

URL: http://svn.apache.org/viewvc?rev=812871&view=rev
Log:
MATH-292 TestUtils.assertRelativelyEquals() generates misleading error on failure

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java?rev=812871&r1=812870&r2=812871&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java Wed Sep
 9 10:11:15 2009
@@ -169,8 +169,8 @@
         } else if (expected == 0.0) {
             Assert.assertEquals(msg, actual, expected, relativeError);
         } else {
-            double x = Math.abs((expected - actual) / expected);
-            Assert.assertEquals(msg, 0.0, x, relativeError);
+            double absError = Math.abs(expected) * relativeError;
+            Assert.assertEquals(msg, expected, actual, absError);
         }
     }
 



Mime
View raw message