From: richardgraham Date: Fri, 17 Aug 2012 07:09:51 +0000 (+0000) Subject: Fixed of-by-one bug in trapz integrator X-Git-Tag: upstream/12.09^2~51 X-Git-Url: https://git.gag.com/?p=debian%2Fopenrocket;a=commitdiff_plain;h=ed703c494f30cb24f14aad96d9c8ad9f8f8fd332 Fixed of-by-one bug in trapz integrator git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@973 180e2498-e6e9-4542-8430-84ac67f01cd8 --- diff --git a/core/src/net/sf/openrocket/util/ArrayUtils.java b/core/src/net/sf/openrocket/util/ArrayUtils.java index 8f0db530..7d373096 100644 --- a/core/src/net/sf/openrocket/util/ArrayUtils.java +++ b/core/src/net/sf/openrocket/util/ArrayUtils.java @@ -95,7 +95,7 @@ public class ArrayUtils { * dt is the time step between each array value */ public static double trapz(double[] y, double dt){ - double stop = y.length * dt; + double stop = (y.length -1) * dt; if (y.length <= 1 || dt <= 0) return 0;