X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Futil%2FArrayUtils.java;h=8e504a55e7ea37abe45c114eef7002367b51b28b;hb=cbfd370eecee19979823b7a1953ae1ee55633369;hp=59290b12d9c8fd48401436ad62bf93dffc2330f4;hpb=6b96ffaaa9c6cebe2e3d15e07826f181fb0f3d5a;p=debian%2Fopenrocket diff --git a/core/src/net/sf/openrocket/util/ArrayUtils.java b/core/src/net/sf/openrocket/util/ArrayUtils.java index 59290b12..8e504a55 100644 --- a/core/src/net/sf/openrocket/util/ArrayUtils.java +++ b/core/src/net/sf/openrocket/util/ArrayUtils.java @@ -10,7 +10,12 @@ public class ArrayUtils { */ public static double[] range(double start, double stop, double step){ - int size = (int) Math.floor(((stop - start) / step)); + int size = 0 ; + if ( stop <= start ) { + size = 0; + } else { + size = (int) Math.ceil(((stop - start) / step)); + } //System.out.println("Range from "+start+" to "+stop+" step "+step+" has length "+size);