commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [math] removing the two asserts in MathUtils.equals(double, double, int) and MathUtils.equals(float, float, int)
Date Sun, 10 Apr 2011 20:45:11 GMT
On 4/10/11 1:48 PM, Gilles Sadowski wrote:
> Hello Luc.
>
>> [...]
>>
>> I propose to change the  "maxUlps > 0" into "maxUlps >= 0" and either
>>
>>  1) comment out the corresponding asserts (just as the other ones in
>>     the file are commented out)
>>  2) replace the asserts by a real test and throw a
>>     MathIllegalArgumentException
>>  3) remove the asserts without replacement
>>
>> I would prefer choice 1.
>>
>> What do you think ?
> The line with the "assert" was a remnant from the original code:
>   http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
> where a paragraph warns about the caveat related to NaNs.
>
> I think that this is in effect handled with the last line of the Java code:
> -----
>     return isEqual && !Double.isNaN(x) && !Double.isNaN(y);
> -----
>
> Thus, the assert not necessary.
> Option 3) would be fine, I think.
+1
Phil
>
> Gilles
>
> ---------------------------------------------------------------------
> 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