commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <billwbar...@verizon.net>
Subject Re: [Math] NaN in "equals"
Date Sun, 09 May 2010 00:12:40 GMT


--------------------------------------------------
From: "Gilles Sadowski" <gilles@harfang.homelinux.org>
Sent: Thursday, May 06, 2010 5:09 AM
To: <dev@commons.apache.org>
Subject: [Math] NaN in "equals"

> Hello.
>
> In the "MathUtils" class, "equals" methods consider that a NaN is equal to 
> a
> NaN. It seems that the orthodox view is that such a comparison should 
> return
> "false".
> Is there a rationale behind the current behaviour (e.g. it is admittedly
> more efficient to not call "Double.isNaN")?
> Or can I make the changes in order to comply to IEEE?
>

Well, that is the convention in most of the library, so would be -1 to 
changing it only in MathUtils since it would then be inconsistent (e.g. 
ArrayRealVector.equals returns "true" if both vectors have a NaN in some 
(not necessarily the same) position.  I would be -0.5 to changing it in a 
point release, since there may be users that are relying on the current 
behavior and point releases are supposed to be drop in replacements.  I 
don't have strong feelings either way for the next major release.

>
> Best,
> 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