IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2007, 3:19:55 AM (19 years ago)
Author:
rhl
Message:

Check for Inf/NaN when getting a vector's min/max

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psStats.c

    r12999 r13418  
    1313 * use ->min and ->max (PS_STAT_USE_RANGE)
    1414 *
    15  *  @version $Revision: 1.209 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2007-04-24 22:27:44 $
     15 *  @version $Revision: 1.210 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2007-05-18 13:19:55 $
    1717 *
    1818 *  Copyright 2006 IfA, University of Hawaii
     
    259259    for (long i = 0; i < num; i++) {
    260260        // Check if the data is with the specified range
     261        if (!isfinite(vector[i])) {
     262            stats->max = stats->min = NAN;
     263            psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);
     264            return 0;
     265        }
     266       
    261267        if (useRange && (vector[i] < stats->min))
    262268            continue;
Note: See TracChangeset for help on using the changeset viewer.