changeset 193:f2babe7f11c0

Move the zero check to Statistics.getPercentile.
author shade
date Fri, 27 Sep 2013 12:02:40 +0400
parents b96824f0578d
children b7403ff13303
files jmh-core/src/main/java/org/openjdk/jmh/util/internal/Statistics.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/internal/Statistics.java	Fri Sep 27 11:42:32 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/internal/Statistics.java	Fri Sep 27 12:02:40 2013 +0400
@@ -185,14 +185,14 @@
     }
 
     public double getPercentile(double rank) {
-        if (getN() == 0) {
-            return Double.NaN;
-        }
-
         return getPercentile(getValues(), rank);
     }
 
     static double getPercentile(double[] values, double rank) {
+        if (values.length == 0) {
+            return Double.NaN;
+        }
+
         Arrays.sort(values);
 
         int n1 = (int) Math.floor(rank / 100.0D * values.length);