Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

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

  • Subject: [Fwd: Re: Bug in NetCDF's MAMath.java?]
  • From: John Caron <caron@xxxxxxxxxxxxxxxx>
  • Date: Fri, 04 Mar 2005 20:37:15 -0700


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




  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: