Index: /branches/rel-1_0/psLib/src/math/psStats.c
===================================================================
--- /branches/rel-1_0/psLib/src/math/psStats.c	(revision 12339)
+++ /branches/rel-1_0/psLib/src/math/psStats.c	(revision 12340)
@@ -13,6 +13,6 @@
  * use ->min and ->max (PS_STAT_USE_RANGE)
  *
- *  @version $Revision: 1.199 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-01-19 04:32:27 $
+ *  @version $Revision: 1.199.2.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-08 23:24:48 $
  *
  *  Copyright 2006 IfA, University of Hawaii
@@ -2158,10 +2158,9 @@
 
         //
-        // Ensure that the y values are monotonic.
+        // Ensure that the x values are monotonic.
         //
-        if (((y->data.F64[0] < y->data.F64[1]) && !(y->data.F64[1] <= y->data.F64[2])) ||
-                ((y->data.F64[0] > y->data.F64[1]) && !(y->data.F64[1] >= y->data.F64[2]))) {
+        if (!(x->data.F64[0] < x->data.F64[1] && x->data.F64[1] < x->data.F64[2])) {
             psError(PS_ERR_UNKNOWN, true,
-                    "This routine must be called with monotonically increasing or decreasing data points.\n");
+                    "This routine must be called with monotonically increasing ordinates.\n");
             psFree(x);
             psFree(y);
@@ -2172,5 +2171,5 @@
         // Determine the coefficients of the polynomial.
         psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2);
-        if (!psVectorFitPolynomial1D(myPoly, NULL, 0, y, NULL, x)) {
+        if (!psVectorFitPolynomial1D(myPoly, NULL, 0, y, NULL, x)) { // fit y(x)
             psError(PS_ERR_UNEXPECTED_NULL, false,
                     _("Failed to fit a 1-dimensional polynomial to the three specified data points.  Returning NAN."));
@@ -2183,8 +2182,8 @@
         psTrace("psLib.math", 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]);
         psTrace("psLib.math", 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]);
-        psTrace("psLib.math", 6, "Fitted y vec is (%f %f %f)\n",
-                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]),
-                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[1]),
-                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[2]));
+        psTrace("psLib.math", 6, "Fitted x vec is (%f %f %f)\n",
+                (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[0]),
+                (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[1]),
+                (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[2]));
 
         psTrace("psLib.math", 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal);
