IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2004, 2:22:53 PM (22 years ago)
Author:
gusciora
Message:

Added parameter checking to psStats.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psConstants.h

    r2221 r2224  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 23:31:43 $
     8 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-28 00:22:53 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#define PS_INT_CHECK_NON_NEGATIVE(NAME, RVAL) \
    3333if (NAME < 0) { \
    34     psError(__func__,"%s is less than 0.", #NAME); \
     34    psError(__func__,"Error: %s is less than 0.", #NAME); \
    3535    return(RVAL); \
    3636}
     
    3838#define PS_INT_CHECK_POSITIVE(NAME, RVAL) \
    3939if (NAME < 1) { \
    40     psError(__func__,"%s is 0 or less.", #NAME); \
    41     return(RVAL); \
    42 }
    43 
     40    psError(__func__,"Error: %s is 0 or less.", #NAME); \
     41    return(RVAL); \
     42}
     43
     44// Produce an error if ((NAME1 > NAME2)
    4445#define PS_INT_COMPARE(NAME1, NAME2, RVAL) \
    45 if (NAME1 < NAME2) { \
    46     psError(__func__,"%s is less than %s (%d < %D).", #NAME1, #NAME2, NAME1, NAME2); \
    47     return(RVAL); \
    48 }
    49 
    50 
     46if (NAME1 > NAME2) { \
     47    psError(__func__,"Error: (%s > %s) (%d %d).", #NAME1, #NAME2, NAME1, NAME2); \
     48    return(RVAL); \
     49}
     50
     51
     52// Produce an error if ((NAME1 > NAME2)
    5153#define PS_FLOAT_COMPARE(NAME1, NAME2, RVAL) \
    52 if ((NAME1 - NAME2) < -FLT_EPSILON) { \
    53     psError(__func__,"%s is less than %s.", #NAME1, #NAME2); \
    54     return(RVAL); \
    55 }
    56 
    57 
     54if (NAME1 > NAME2) { \
     55    psError(__func__,"Error: (%s > %s) (%f %f)", #NAME1, #NAME2, NAME1, NAME2); \
     56    return(RVAL); \
     57}
     58
     59#define PS_FLOAT_CHECK_NON_EQUAL(NAME1, NAME2, RVAL) \
     60if (fabs(NAME2 - NAME1) < FLT_EPSILON) { \
     61    psError(__func__,"Error: %s and %s are equal.", #NAME1, #NAME2); \
     62    return(RVAL); \
     63}
    5864
    5965/*****************************************************************************
Note: See TracChangeset for help on using the changeset viewer.