Index: /trunk/psLib/src/math/psHistogram.c
===================================================================
--- /trunk/psLib/src/math/psHistogram.c	(revision 12433)
+++ /trunk/psLib/src/math/psHistogram.c	(revision 12434)
@@ -5,6 +5,6 @@
  *  @author GLG (MHPCC), EAM (IfA)
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-13 03:01:24 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-14 02:36:28 $
  *
  *  Copyright 2006 IfA, University of Hawaii
@@ -306,18 +306,17 @@
                     // correct bin number requires a bit more work.
                     tmpScalar.data.F32 = inF32->data.F32[i];
-                    binNum = p_psVectorBinDisect( *(psVector* *)&out->bounds, &tmpScalar);
-                    if (binNum < 0) {
-                        psLogMsg(__func__, PS_LOG_WARN,
-                                 "WARNING: psVectorHistogram(): element outside histogram bounds.\n");
-                    } else {
-                        if (errorsF32 != NULL) {
-                            if (!UpdateHistogramBins(binNum, out, inF32->data.F32[i], errors->data.F32[i])) {
-                                psLogMsg(__func__, PS_LOG_WARN, "WARNING: Failed to update the histogram "
-                                         "bins with the errors vector.\n");
-                            }
-                        } else {
-                            out->nums->data.F32[binNum] += 1.0;
-                        }
-                    }
+		    psVectorBinaryDisectResult result;
+                    binNum = psVectorBinaryDisect(&result, out->bounds, &tmpScalar);
+		    if (result != PS_BINARY_DISECT_PASS) {
+			continue;
+		    }
+		    if (errorsF32 != NULL) {
+			if (!UpdateHistogramBins(binNum, out, inF32->data.F32[i], errors->data.F32[i])) {
+			    psLogMsg(__func__, PS_LOG_WARN, "WARNING: Failed to update the histogram "
+				     "bins with the errors vector.\n");
+			}
+		    } else {
+			out->nums->data.F32[binNum] += 1.0;
+		    }
                 }
             }
Index: /trunk/psLib/src/math/psMathUtils.c
===================================================================
--- /trunk/psLib/src/math/psMathUtils.c	(revision 12433)
+++ /trunk/psLib/src/math/psMathUtils.c	(revision 12434)
@@ -3,6 +3,6 @@
  *  This file contains standard math routines.
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-01-09 22:38:53 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-14 02:36:28 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -31,4 +31,5 @@
 #include "psAssert.h"
 #include "psConstants.h"
+#include "psAbort.h"
 
 /*****************************************************************************/
@@ -55,5 +56,5 @@
 This is a macro covering the various types for the below function.
  *****************************************************************************/
-#define VECTOR_BIN_DISECT_CASE(TYPE) \
+#define VECTOR_BINARY_DISECT_CASE(TYPE) \
 case PS_TYPE_##TYPE: { \
     ps##TYPE *bounds = bins->data.TYPE; \
@@ -65,14 +66,16 @@
     /* psTrace("psLib.math", 6, "Determining the bin for: %f\n", x); */\
     if (value < bounds[0]) { \
-        psLogMsg(__func__, PS_LOG_WARN, \
-                 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \
-                 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
-        return(-2); \
+        psTrace("psLib.math", 3, \
+                 "psVectorBinaryDisect : ordinate %f is outside vector range (%f - %f).", \
+                 (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
+        *status = PS_BINARY_DISECT_OUTSIDE_RANGE; \
+        return (0); \
     } \
     if (value > bounds[numBins-1]) { \
-        psLogMsg(__func__, PS_LOG_WARN, \
-                 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \
-                 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
-        return(-1); \
+        psTrace("psLib.math", 3, \
+                 "psVectorBinaryDisect : ordinate %f is outside vector range (%f - %f).", \
+                 (double)value, (double)bounds[0], (double)bounds[numBins-1]); \
+        *status = PS_BINARY_DISECT_OUTSIDE_RANGE; \
+        return (numBins-1); \
     } \
     \
@@ -97,38 +100,43 @@
 
 /*****************************************************************************
-p_psVectorBinDisect(): This function takes as input an array of data as well as a single value for that data.
+psVectorBinDisect(): This function takes as input an array of data as well as a single value for that data.
 The input vector values are assumed to be non-decreasing (v[i-1] <= v[i] for all 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 (-2 or -1).
   *****************************************************************************/
-psS32 p_psVectorBinDisect(
+psS32 psVectorBinaryDisect(
+    psVectorBinaryDisectResult *status,
     const psVector *bins,
     const psScalar *x)
 {
-    PS_ASSERT_VECTOR_NON_NULL(bins, -4);
-    PS_ASSERT_VECTOR_NON_EMPTY(bins, -4);
-    PS_ASSERT_PTR_NON_NULL(x, -6);
-    PS_ASSERT_PTR_TYPE_EQUAL(x, bins, -3);
+    PS_ASSERT_GENERAL_VECTOR_NON_NULL (bins, *status = PS_BINARY_DISECT_INVALID_INPUT; return 0);
+    PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(bins, *status = PS_BINARY_DISECT_INVALID_INPUT; return 0);
+    PS_ASSERT_GENERAL_PTR_NON_NULL(x, *status = PS_BINARY_DISECT_INVALID_INPUT; return 0);
+    PS_ASSERT_GENERAL_PTR_TYPE_EQUAL(x, bins, *status = PS_BINARY_DISECT_INVALID_INPUT; return 0);
     long numBins = bins->n;             // Number of bins
 
+    *status = PS_BINARY_DISECT_PASS;
+
     switch (x->type.type) {
-        VECTOR_BIN_DISECT_CASE(S8);
-        VECTOR_BIN_DISECT_CASE(S16);
-        VECTOR_BIN_DISECT_CASE(S32);
-        VECTOR_BIN_DISECT_CASE(S64);
-        VECTOR_BIN_DISECT_CASE(U8);
-        VECTOR_BIN_DISECT_CASE(U16);
-        VECTOR_BIN_DISECT_CASE(U32);
-        VECTOR_BIN_DISECT_CASE(U64);
-        VECTOR_BIN_DISECT_CASE(F32);
-        VECTOR_BIN_DISECT_CASE(F64);
+        VECTOR_BINARY_DISECT_CASE(S8);
+        VECTOR_BINARY_DISECT_CASE(S16);
+        VECTOR_BINARY_DISECT_CASE(S32);
+        VECTOR_BINARY_DISECT_CASE(S64);
+        VECTOR_BINARY_DISECT_CASE(U8);
+        VECTOR_BINARY_DISECT_CASE(U16);
+        VECTOR_BINARY_DISECT_CASE(U32);
+        VECTOR_BINARY_DISECT_CASE(U64);
+	VECTOR_BINARY_DISECT_CASE(F32);
+        VECTOR_BINARY_DISECT_CASE(F64);
     default: {
             char* strType;
             PS_TYPE_NAME(strType, x->type.type);
             psError(PS_ERR_BAD_PARAMETER_TYPE, "psLib type %s is not supported.", strType);
-            return -1;
+	    *status = PS_BINARY_DISECT_INVALID_TYPE;
+            return 0;
         }
     }
-    return(-3);
+    psAbort ("programming error");
+    return (0);
 }
 
@@ -151,5 +159,6 @@
     } \
     psVector *p = psVectorCopy(NULL, range, PS_TYPE_##TYPE); \
-    psS32 binNum = p_psVectorBinDisect(domain, x); \
+    psVectorBinaryDisectResult result; \
+    psS32 binNum = psVectorBinaryDisect(&result, domain, x); \
     \
     psS32 numIntPoints = order+1; \
Index: /trunk/psLib/src/math/psMathUtils.h
===================================================================
--- /trunk/psLib/src/math/psMathUtils.h	(revision 12433)
+++ /trunk/psLib/src/math/psMathUtils.h	(revision 12434)
@@ -6,6 +6,6 @@
  * @author GLG, MHPCC
  *
- * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-01-23 22:47:23 $
+ * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-03-14 02:36:28 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -25,4 +25,11 @@
 #include "psPolynomial.h"
 
+typedef enum {
+    PS_BINARY_DISECT_PASS,
+    PS_BINARY_DISECT_OUTSIDE_RANGE,
+    PS_BINARY_DISECT_INVALID_INPUT,
+    PS_BINARY_DISECT_INVALID_TYPE,
+} psVectorBinaryDisectResult;
+
 /** Performs a binary disection on a monotonically non-decreasing vector.
  *  Searches through an array of data for a specified value.
@@ -30,5 +37,6 @@
  *  @return psS32    corresponding index number of specified value
  */
-psS32 p_psVectorBinDisect(
+psS32 psVectorBinaryDisect(
+    psVectorBinaryDisectResult *status,
     const psVector *bins,               ///< Array of non-decreasing values
     const psScalar *x                   ///< Target value to find
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 12433)
+++ /trunk/psLib/src/math/psSpline.c	(revision 12434)
@@ -6,6 +6,6 @@
 *  This file contains the routines that allocate, free, and evaluate splines.
 *
-*  @version $Revision: 1.157 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-01-09 22:38:53 $
+*  @version $Revision: 1.158 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-14 02:36:28 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -386,6 +386,7 @@
     tmpScalar.type.type = PS_TYPE_F32;
     tmpScalar.data.F32 = x;
-    psS32 binNum = p_psVectorBinDisect(spline->knots, &tmpScalar);
-    if (binNum < 0) {
+    psVectorBinaryDisectResult result;
+    psS32 binNum = psVectorBinaryDisect(&result, spline->knots, &tmpScalar);
+    if (result != PS_BINARY_DISECT_PASS) {
         psError(PS_ERR_UNKNOWN, false, "Could not perform bin dissection on spline->knots.\n");
         return(NAN);
