Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 41503)
+++ trunk/psLib/src/math/psStats.c	(revision 41520)
@@ -377,6 +377,6 @@
     }
 
-    int Qmin = (int)0.25*count;
-    int Qmax = (int)0.75*count;
+    int Qmin = (int)(0.25*count);
+    int Qmax = (int)(0.75*count);
     psAssert (Qmin >=           0, "oops");
     psAssert (Qmin < outVector->n, "oops");
@@ -385,7 +385,7 @@
 
     // Calculate the quartile points exactly.
-    stats->sampleUQ = output[(int)(0.75*count)];
-    stats->sampleLQ = output[(int)(0.25*count)];
-
+    stats->sampleUQ = output[Qmax];
+    stats->sampleLQ = output[Qmin];
+     
     stats->results |= PS_STAT_SAMPLE_MEDIAN;
     stats->results |= PS_STAT_SAMPLE_QUARTILE;
@@ -1915,8 +1915,8 @@
 	// NOTE: vectorSampleMedian only returns 'false' for very bad cases:
 	// NULL input vector, psVectorCopy failure, invalid vector type (likely programming errors)
-        if (!vectorSampleMedian(inF32, maskVector, maskVal, stats)) {
-            psError(PS_ERR_UNKNOWN, false, "Failed to calculate sample median");
-            status &= false;
-        }
+	if (!vectorSampleMedian(inF32, maskVector, maskVal, stats)) {
+	    psError(PS_ERR_UNKNOWN, false, "Failed to calculate sample median");
+	    status &= false;
+	}
     }
 
