commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: DO NOT REPLY [Bug 37019] - [math] NaN handling in StatsUtil.min, StatsUtil.max methods
Date Fri, 14 Oct 2005 03:38:58 GMT
This should be discussed in a separate ticket against the Complex
class (done now - 37086).

The general policy in [math] is to use NaN consistently with floating
point arithemtic specs (IEEE 754 for real, C99x Annex G for complex
arithmetic) so for statistics such as Sum, Mean, etc. that involve
arithmetic computations, NaN values force the return value to be NaN.

The Min and Max order statistics ignore NaNs.  Slightly
inconsistently, the Percentile and Median order statistics use the
total ordering determined by Double.compareTo which considers NaN as
larger than any value (including Double.POSITIVE_INFINITY) and
consider NaNs in the computation.  All of this is specified in the
javadoc for these statistics.


> ------- Additional Comments From  2005-10-13 16:45 -------
> The Complex class also has some questionable and undocumented behavior with
> respect to NaN (and Inf). It might be worthwhile considering on a general NaN
> policy for the math classes.
> --

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message