Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 8245)
+++ trunk/psLib/src/math/psStats.c	(revision 8627)
@@ -16,6 +16,6 @@
  * use ->min and ->max (PS_STAT_USE_RANGE)
  *
- *  @version $Revision: 1.184 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-09 02:26:44 $
+ *  @version $Revision: 1.185 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-26 04:34:28 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -665,10 +665,10 @@
     if (count == 0) {
         stats->sampleStdev = NAN;
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (%d).  Setting stats->sampleStdev = NAN.\n", count);
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (%ld).  Setting stats->sampleStdev = NAN.\n", count);
         return false;
     }
     if (count == 1) {
         stats->sampleStdev = 0.0;
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (%d).  Setting stats->sampleStdev = 0.0.\n", count);
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (%ld).  Setting stats->sampleStdev = 0.0.\n", count);
         return false;
     }
@@ -713,7 +713,7 @@
 
     // Ensure that stats->clipSigma is within the proper range.
-    PS_ASSERT_INT_WITHIN_RANGE(stats->clipSigma,
-                               PS_CLIPPED_SIGMA_LB,
-                               PS_CLIPPED_SIGMA_UB, -1);
+    PS_ASSERT_FLOAT_WITHIN_RANGE(stats->clipSigma,
+                                 PS_CLIPPED_SIGMA_LB,
+                                 PS_CLIPPED_SIGMA_UB, -1);
 
     // Allocate a psStats structure for calculating the mean, median, and
@@ -777,5 +777,5 @@
                         fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) {
                     tmpMask->data.U8[j] = 0xff;
-                    psTrace("psLib.math", 10, "Clipped %d: %f +/- %f\n", j,
+                    psTrace("psLib.math", 10, "Clipped %ld: %f +/- %f\n", j,
                             myVector->data.F32[j], errors->data.F32[j]);
                     numClipped++;
@@ -788,5 +788,5 @@
                         fabsf(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
                     tmpMask->data.U8[j] = 0xff;
-                    psTrace("psLib.math", 10, "Clipped %d: %f\n", j, myVector->data.F32[j]);
+                    psTrace("psLib.math", 10, "Clipped %ld: %f\n", j, myVector->data.F32[j]);
                     numClipped++;
                     clipped = true;
@@ -896,6 +896,6 @@
     PS_ASSERT_VECTOR_TYPE(yVec, PS_TYPE_F32, NAN);
     //    PS_ASSERT_VECTORS_SIZE_EQUAL(xVec, yVec, NAN);
-    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (xVec->n - 1), NAN);
-    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (yVec->n - 1), NAN);
+    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(xVec->n - 1), NAN);
+    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(yVec->n - 1), NAN);
 
     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
@@ -1008,8 +1008,8 @@
     psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(params, NAN);
-    PS_ASSERT_VECTOR_SIZE(params, 2, NAN);
+    PS_ASSERT_VECTOR_SIZE(params, (long)2, NAN);
     PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, NAN);
     PS_ASSERT_VECTOR_NON_NULL(coords, NAN);
-    PS_ASSERT_VECTOR_SIZE(coords, 1, NAN);
+    PS_ASSERT_VECTOR_SIZE(coords, (long)1, NAN);
     PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, NAN);
 
@@ -1020,5 +1020,5 @@
     psF32 gauss = psGaussian(x, mean, stdev, false);
     if (deriv) {
-        PS_ASSERT_VECTOR_SIZE(deriv, 2, NAN);
+        PS_ASSERT_VECTOR_SIZE(deriv, (long)2, NAN);
         PS_ASSERT_VECTOR_TYPE(deriv, PS_TYPE_F32, NAN);
         psF32 tmp = (x - mean) * gauss;
@@ -1136,5 +1136,5 @@
         // we get here, we know that binSize != 0.0.
         long numBins = (max - min) / binSize; // Number of bins
-        psTrace("psLib.math", 6, "Numbins is %d\n", numBins);
+        psTrace("psLib.math", 6, "Numbins is %ld\n", numBins);
         psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
         // Generate the histogram
@@ -1159,5 +1159,5 @@
         // ADD step 2: Find the bin which contains the 50% data point.
         totalDataPoints = cumulative->nums->data.F32[numBins - 1];
-        psTrace("psLib.math", 6, "Total data points is %d\n", totalDataPoints);
+        psTrace("psLib.math", 6, "Total data points is %ld\n", totalDataPoints);
         long binMedian;
         if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) {
@@ -1170,5 +1170,5 @@
             if (binMedian < 0) {
                 psError(PS_ERR_UNKNOWN, false,
-                        "Failed to calculate the 50 precent data point (%d).\n", binMedian);
+                        "Failed to calculate the 50 precent data point (%ld).\n", binMedian);
                 psFree(statsMinMax);
                 psFree(histogram);
@@ -1179,5 +1179,5 @@
             }
         }
-        psTrace("psLib.math", 6, "The median bin is %d (%.2f to %.2f)\n", binMedian,
+        psTrace("psLib.math", 6, "The median bin is %ld (%.2f to %.2f)\n", binMedian,
                 cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]);
 
@@ -1217,5 +1217,5 @@
             }
         }
-        psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n",
+        psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%ld, %ld).\n",
                 binLo, binHi);
         psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));
@@ -1248,7 +1248,7 @@
         #else
         // This code basically interpolates to find the positions exactly.
-        psTrace("psLib.math", 6, "binLo is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
+        psTrace("psLib.math", 6, "binLo is %ld.  Nums at that bin and the next are (%.2f, %.2f)\n",
                 binLo, cumulative->nums->data.F32[binLo], cumulative->nums->data.F32[binLo+1]);
-        psTrace("psLib.math", 6, "binHi is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
+        psTrace("psLib.math", 6, "binHi is %ld.  Nums at that bin and the next are (%.2f, %.2f)\n",
                 binHi, cumulative->nums->data.F32[binHi], cumulative->nums->data.F32[binHi+1]);
 
@@ -1304,5 +1304,5 @@
             psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n");
             psTrace("psLib.math", 6,
-                    "The median is at bin number %d.  We mask bins outside the bin range (%d:%d)\n",
+                    "The median is at bin number %ld.  We mask bins outside the bin range (%ld:%ld)\n",
                     binMedian, maskLo, maskHi);
             psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi);
@@ -1310,5 +1310,5 @@
                 if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) {
                     mask->data.U8[i] = 0xff;
-                    psTrace("psLib.math", 6, "Masking element %d is %f\n", i, myVector->data.F32[i]);
+                    psTrace("psLib.math", 6, "Masking element %ld is %f\n", i, myVector->data.F32[i]);
                 }
             }
@@ -1350,5 +1350,5 @@
         return false;
     }
-    psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25);
+    psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%ld, %ld).\n", binLo25, binHi25);
 
     // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile
@@ -1381,5 +1381,5 @@
     }
     stats->robustN50 = N50;
-    psTrace("psLib.math", 6, "The robustN50 is %d.\n", N50);
+    psTrace("psLib.math", 6, "The robustN50 is %ld.\n", N50);
 
 
@@ -1413,5 +1413,5 @@
         psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max);
         psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize);
-        psTrace("psLib.math", 6, "The numBins is %d\n", numBins);
+        psTrace("psLib.math", 6, "The numBins is %ld\n", numBins);
 
         psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers)
@@ -1460,5 +1460,5 @@
             }
         }
-        psTrace("psLib.math", 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums);
+        psTrace("psLib.math", 6, "The peak bin is %ld, with %f data.n", binNum, binMaxNums);
 
         // Fit a Gaussian to the bins in the range 20 sigma of the robust histogram median.
@@ -1696,5 +1696,5 @@
     PS_ASSERT_VECTOR_NON_NULL(bounds, NULL);
     PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL);
-    PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(bounds->n, 2, NULL);
+    PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(bounds->n, (long)2, NULL);
 
     // Allocate memory for the new histogram structure.
@@ -1761,5 +1761,5 @@
     PS_ASSERT_PTR_NON_NULL(out->bounds, false);
     PS_ASSERT_PTR_NON_NULL(out->nums, false);
-    PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, ((out->nums->n)-1), false);
+    PS_ASSERT_LONG_WITHIN_RANGE(binNum, (long)0, (long)((out->nums->n)-1), false);
     PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(error, 0.0, false);
     PS_ASSERT_FLOAT_WITHIN_RANGE(data, out->bounds->data.F32[0],
