Index: /trunk/psLib/src/dataManip/psConstants.h
===================================================================
--- /trunk/psLib/src/dataManip/psConstants.h	(revision 1902)
+++ /trunk/psLib/src/dataManip/psConstants.h	(revision 1903)
@@ -1,5 +1,14 @@
-//
-// Source code comments.
-//
+/** @file  psComments.h
+ *
+ *  This file will hold definitions of various constants as well as common
+ *  macros used throughout psLib.
+ *
+ *  @author GLG, MHPCC
+ *
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 
 #define DETERMINE_BRACKET_STEP_SIZE 0.10
@@ -9,2 +18,44 @@
 #define RIGHT_SPLINE_DERIV 0.0
 
+/** Preprocessor macro to generate error on an incorrect type */
+#define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
+if (NAME->type.type != TYPE) { \
+    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on a NULL vector */
+#define PS_CHECK_NULL_VECTOR(NAME) \
+if (NAME == NULL || NAME->data.V == NULL) { \
+    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on a NULL poniter */
+#define PS_CHECK_NULL_PTR(NAME) \
+if (NAME == NULL) { \
+    psError(__func__,"Invalid operation: %s is NULL.", #NAME); \
+}
+
+/** Preprocessor macro to generate error for zero length vector */
+#define PS_CHECK_EMPTY_VECTOR(NAME) \
+if (NAME->n < 1) { \
+    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on differing size vectors */
+#define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
+if (VEC1->n != VEC2->n) { \
+    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
+}
+
+#define PS_PRINT_VECTOR(NAME) \
+for (int my_i=0;my_i<NAME->n;my_i++) { \
+    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
+} \
+printf("\n"); \
+
+#define PS_MAX(A, B) \
+(A > B) ? A : B \
+
+#define PS_MIN(A, B) \
+(A < B) ? A : B \
+
Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 1902)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 1903)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-23 06:12:22 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1699,5 +1699,5 @@
 all j>=i).  This routine does a binary disection of the vector and returns
 "i" such that (v[i] <= x <= v[i+1).  If x lies outside the range of v[],
-then this routine prints a warning message and returns -1.
+then this routine prints a warning message and returns (-2 or -1).
  
 XXX: Macro this for a few different types.
@@ -1716,6 +1716,12 @@
             "---- Calling p_psVectorBinDisectF32(%f)\n", x);
 
-    if ((x < bins[0]) ||
-            (x > bins[numBins-1])) {
+    if (x < bins[0]) {
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
+                 x, bins[0], bins[numBins-1]);
+        return(-2);
+    }
+
+    if (x > bins[numBins-1]) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 1902)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 1903)
@@ -7,8 +7,8 @@
  *  on those data structures.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 20:08:22 $
+ *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -34,4 +34,5 @@
 #include "psMinimize.h"
 #include "psFunctions.h"
+#include "psConstants.h"
 
 /*****************************************************************************/
@@ -51,34 +52,4 @@
 void p_psVectorRobustStats(const psVector* restrict myVector,
                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
-
-/** Preprocessor macro to generate error on an incorrect type */
-#define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
-if (NAME->type.type != TYPE) { \
-    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
-}
-
-/** Preprocessor macro to generate error on a NULL vector */
-#define PS_CHECK_NULL_VECTOR(NAME) \
-if (NAME == NULL || NAME->data.V == NULL) { \
-    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
-}
-
-/** Preprocessor macro to generate error for zero length vector */
-#define PS_CHECK_EMPTY_VECTOR(NAME) \
-if (NAME->n < 1) { \
-    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
-}
-
-/** Preprocessor macro to generate error on differing size vectors */
-#define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
-if (VEC1->n != VEC2->n) { \
-    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
-}
-
-#define PS_PRINT_VECTOR(NAME) \
-for (int my_i=0;my_i<NAME->n;my_i++) { \
-    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
-} \
-printf("\n"); \
 
 
Index: /trunk/psLib/src/math/psConstants.h
===================================================================
--- /trunk/psLib/src/math/psConstants.h	(revision 1902)
+++ /trunk/psLib/src/math/psConstants.h	(revision 1903)
@@ -1,5 +1,14 @@
-//
-// Source code comments.
-//
+/** @file  psComments.h
+ *
+ *  This file will hold definitions of various constants as well as common
+ *  macros used throughout psLib.
+ *
+ *  @author GLG, MHPCC
+ *
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 
 #define DETERMINE_BRACKET_STEP_SIZE 0.10
@@ -9,2 +18,44 @@
 #define RIGHT_SPLINE_DERIV 0.0
 
+/** Preprocessor macro to generate error on an incorrect type */
+#define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
+if (NAME->type.type != TYPE) { \
+    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on a NULL vector */
+#define PS_CHECK_NULL_VECTOR(NAME) \
+if (NAME == NULL || NAME->data.V == NULL) { \
+    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on a NULL poniter */
+#define PS_CHECK_NULL_PTR(NAME) \
+if (NAME == NULL) { \
+    psError(__func__,"Invalid operation: %s is NULL.", #NAME); \
+}
+
+/** Preprocessor macro to generate error for zero length vector */
+#define PS_CHECK_EMPTY_VECTOR(NAME) \
+if (NAME->n < 1) { \
+    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
+}
+
+/** Preprocessor macro to generate error on differing size vectors */
+#define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
+if (VEC1->n != VEC2->n) { \
+    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
+}
+
+#define PS_PRINT_VECTOR(NAME) \
+for (int my_i=0;my_i<NAME->n;my_i++) { \
+    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
+} \
+printf("\n"); \
+
+#define PS_MAX(A, B) \
+(A > B) ? A : B \
+
+#define PS_MIN(A, B) \
+(A < B) ? A : B \
+
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 1902)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 1903)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-23 06:12:22 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1699,5 +1699,5 @@
 all j>=i).  This routine does a binary disection of the vector and returns
 "i" such that (v[i] <= x <= v[i+1).  If x lies outside the range of v[],
-then this routine prints a warning message and returns -1.
+then this routine prints a warning message and returns (-2 or -1).
  
 XXX: Macro this for a few different types.
@@ -1716,6 +1716,12 @@
             "---- Calling p_psVectorBinDisectF32(%f)\n", x);
 
-    if ((x < bins[0]) ||
-            (x > bins[numBins-1])) {
+    if (x < bins[0]) {
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
+                 x, bins[0], bins[numBins-1]);
+        return(-2);
+    }
+
+    if (x > bins[numBins-1]) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 1902)
+++ /trunk/psLib/src/math/psSpline.c	(revision 1903)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-23 06:12:22 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1699,5 +1699,5 @@
 all j>=i).  This routine does a binary disection of the vector and returns
 "i" such that (v[i] <= x <= v[i+1).  If x lies outside the range of v[],
-then this routine prints a warning message and returns -1.
+then this routine prints a warning message and returns (-2 or -1).
  
 XXX: Macro this for a few different types.
@@ -1716,6 +1716,12 @@
             "---- Calling p_psVectorBinDisectF32(%f)\n", x);
 
-    if ((x < bins[0]) ||
-            (x > bins[numBins-1])) {
+    if (x < bins[0]) {
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
+                 x, bins[0], bins[numBins-1]);
+        return(-2);
+    }
+
+    if (x > bins[numBins-1]) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).",
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 1902)
+++ /trunk/psLib/src/math/psStats.c	(revision 1903)
@@ -7,8 +7,8 @@
  *  on those data structures.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 20:08:22 $
+ *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-25 23:05:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -34,4 +34,5 @@
 #include "psMinimize.h"
 #include "psFunctions.h"
+#include "psConstants.h"
 
 /*****************************************************************************/
@@ -51,34 +52,4 @@
 void p_psVectorRobustStats(const psVector* restrict myVector,
                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
-
-/** Preprocessor macro to generate error on an incorrect type */
-#define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
-if (NAME->type.type != TYPE) { \
-    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
-}
-
-/** Preprocessor macro to generate error on a NULL vector */
-#define PS_CHECK_NULL_VECTOR(NAME) \
-if (NAME == NULL || NAME->data.V == NULL) { \
-    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
-}
-
-/** Preprocessor macro to generate error for zero length vector */
-#define PS_CHECK_EMPTY_VECTOR(NAME) \
-if (NAME->n < 1) { \
-    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
-}
-
-/** Preprocessor macro to generate error on differing size vectors */
-#define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
-if (VEC1->n != VEC2->n) { \
-    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
-}
-
-#define PS_PRINT_VECTOR(NAME) \
-for (int my_i=0;my_i<NAME->n;my_i++) { \
-    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
-} \
-printf("\n"); \
 
 
