This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
-------- Original Message -------- Subject: Re: Bug in NetCDF's MAMath.java? Date: Fri, 04 Mar 2005 20:16:40 -0700 From: John Caron <address@hidden> To: Eric Russell <address@hidden> References: <p06110406be4ec93f1f13@[129.105.107.75]> Eric Russell wrote:
I've found what I think is a bug in MAMath.java. The getMinMax and getMaximum methods (and their SkipMissingData versions) use Double.MIN_VALUE as the default to compare to values in the array,thanks Eric, you are of course right, i dont know why i didnt find this before !when I think they should be using -Double.MAX_VALUE. Double.MIN_VALUE is the smallest positive value a Java double can hold, so if the max value is negative, you'll get incorrect results. I've been bitten by this in my own code a few times :) I found this in the course of using getMinValue and getMaxValue to findthe limits of a CoordinateAxis. Any suggestions for a work-around? Thanks,Eric
are you are using 2.2? if so, i just released a new version with the fix in it.
thanks very much, John