Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 89840 invoked from network); 17 Jan 2011 19:55:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jan 2011 19:55:29 -0000 Received: (qmail 23300 invoked by uid 500); 17 Jan 2011 19:55:29 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 23237 invoked by uid 500); 17 Jan 2011 19:55:28 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 23230 invoked by uid 99); 17 Jan 2011 19:55:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jan 2011 19:55:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jan 2011 19:55:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7E1502388A9C; Mon, 17 Jan 2011 19:55:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1060060 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/util/FastMath.java site/xdoc/changes.xml test/java/org/apache/commons/math/util/FastMathTest.java Date: Mon, 17 Jan 2011 19:55:01 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110117195501.7E1502388A9C@eris.apache.org> Author: sebb Date: Mon Jan 17 19:55:01 2011 New Revision: 1060060 URL: http://svn.apache.org/viewvc?rev=1060060&view=rev Log: MATH-482 FastMath.max(50.0f, -50.0f) => -50.0f; should be +50.0f Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java commons/proper/math/trunk/src/site/xdoc/changes.xml commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1060060&r1=1060059&r2=1060060&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Mon Jan 17 19:55:01 2011 @@ -3479,7 +3479,7 @@ public class FastMath { * @return b if a is lesser or equal to b, a otherwise */ public static float max(final float a, final float b) { - return (a <= b) ? b : (Float.isNaN(a + b) ? Float.NaN : b); + return (a <= b) ? b : (Float.isNaN(a + b) ? Float.NaN : a); } /** Compute the maximum of two values Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1060060&r1=1060059&r2=1060060&view=diff ============================================================================== --- commons/proper/math/trunk/src/site/xdoc/changes.xml (original) +++ commons/proper/math/trunk/src/site/xdoc/changes.xml Mon Jan 17 19:55:01 2011 @@ -52,6 +52,10 @@ The type attribute can be add,u If the output is not quite correct, check for invisible trailing spaces! --> + + FastMath.max(50.0f, -50.0f) => -50.0f; should be +50.0f + Fixed FastMath.max(float, float) so it returns correct value. + Removed "MathException" from the "throws" clause of the "interpolate" method of the interpolators interfaces (package "analysis.interpolation"). Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathTest.java?rev=1060060&r1=1060059&r2=1060060&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathTest.java Mon Jan 17 19:55:01 2011 @@ -76,18 +76,18 @@ public class FastMathTest { @Test public void testMinMaxFloat() { - double[][] pairs = { - { -50.0, 50.0 }, - { Float.POSITIVE_INFINITY, 1.0 }, - { Float.NEGATIVE_INFINITY, 1.0 }, - { Float.NaN, 1.0 }, - { Float.POSITIVE_INFINITY, 0.0 }, - { Float.NEGATIVE_INFINITY, 0.0 }, - { Float.NaN, 0.0 }, + float[][] pairs = { + { -50.0f, 50.0f }, + { Float.POSITIVE_INFINITY, 1.0f }, + { Float.NEGATIVE_INFINITY, 1.0f }, + { Float.NaN, 1.0f }, + { Float.POSITIVE_INFINITY, 0.0f }, + { Float.NEGATIVE_INFINITY, 0.0f }, + { Float.NaN, 0.0f }, { Float.NaN, Float.NEGATIVE_INFINITY }, { Float.NaN, Float.POSITIVE_INFINITY } }; - for (double[] pair : pairs) { + for (float[] pair : pairs) { Assert.assertEquals("min(" + pair[0] + ", " + pair[1] + ")", Math.min(pair[0], pair[1]), FastMath.min(pair[0], pair[1]),