[Fwd: Re: Bug in NetCDF's MAMath.java?]



-------- Original Message --------
Subject:        Re: Bug in NetCDF's MAMath.java?
Date:   Fri, 04 Mar 2005 20:16:40 -0700
From:   John Caron <caron@xxxxxxxxxxxxxxxx>
To:     Eric Russell <eric-r@xxxxxxxxxxxxxxxx>
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,
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 find
the limits of a CoordinateAxis. Any suggestions for a work-around? Thanks,

Eric

thanks Eric, you are of course right, i dont know why i didnt find this before !

are you are using 2.2? if so, i just released a new version with the fix in it.

thanks very much,

John