Change the implementation of ArrayUtils.range to include the stop value if it is...
[debian/openrocket] / core / src / net / sf / openrocket / util / ArrayUtils.java
index 8e504a55e7ea37abe45c114eef7002367b51b28b..8f0db53081f6ac14609ab9343e005fe2de66c309 100644 (file)
@@ -6,16 +6,11 @@ public class ArrayUtils {
 
        /**
         * Returns a double array with values from start to end with given step.
-        * Starts exactly at start and stops at the step before stop is reached
+        * Starts exactly at start and stops at the multiple of step <= stop
         */
        public static double[] range(double start, double stop, double step){
                
-               int size = 0 ;
-               if ( stop <= start ) {
-                       size = 0;
-               } else {
-                       size = (int) Math.ceil(((stop - start) / step));
-               }
+               int size = (int) Math.floor(((stop - start) / step)) + 1;
                
                //System.out.println("Range from "+start+" to "+stop+" step "+step+" has length "+size);