commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r995035 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
Date Wed, 08 Sep 2010 15:14:27 GMT
On 8 September 2010 15:49, Luc Maisonobe <Luc.Maisonobe@free.fr> wrote:
> Le 08/09/2010 14:51, erans@apache.org a écrit :
>> Author: erans
>> Date: Wed Sep  8 12:51:38 2010
>> New Revision: 995035
>>
>> URL: http://svn.apache.org/viewvc?rev=995035&view=rev
>> Log:
>> Removed strict equality comparison.
>
> In some rare cases, strict equality comparison is desired (I don't know
> if it is the case here). In these cases, findbugs can be configured to
> ignore these cases, see the findbugs-exclude-filter.xml file for an example.

Also, it would be helpful to add a comment to the code to identify any
such cases.

> Luc
>
>>
>> Modified:
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
>>
>> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
>> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java?rev=995035&r1=995034&r2=995035&view=diff
>> ==============================================================================
>> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
(original)
>> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
Wed Sep  8 12:51:38 2010
>> @@ -17,6 +17,7 @@
>>  package org.apache.commons.math.optimization.univariate;
>>
>>  import org.apache.commons.math.FunctionEvaluationException;
>> +import org.apache.commons.math.util.MathUtils;
>>  import org.apache.commons.math.util.FastMath;
>>  import org.apache.commons.math.exception.NumberIsTooSmallException;
>>  import org.apache.commons.math.exception.NotStrictlyPositiveException;
>> @@ -219,12 +220,15 @@ public class BrentOptimizer extends Abst
>>                      } else {
>>                          b = u;
>>                      }
>> -                    if (fu <= fw || w == x) {
>> +                    if (fu <= fw ||
>> +                        MathUtils.equals(w, x)) {
>>                          v = w;
>>                          fv = fw;
>>                          w = u;
>>                          fw = fu;
>> -                    } else if (fu <= fv || v == x || v == w) {
>> +                    } else if (fu <= fv ||
>> +                               MathUtils.equals(v, x) ||
>> +                               MathUtils.equals(v, w)) {
>>                          v = u;
>>                          fv = fu;
>>                      }
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message