From: richardgraham Date: Fri, 14 Sep 2012 05:34:21 +0000 (+0000) Subject: - Workaround for bug with plotting when given INF value. X-Git-Tag: upstream/12.09^2~3 X-Git-Url: https://git.gag.com/?p=debian%2Fopenrocket;a=commitdiff_plain;h=4d321a87d1528772484d666d86f76ece8f5b8117 - Workaround for bug with plotting when given INF value. - Fixed bug with hashing which was not dependent on symbol and would thus give same hash for the range expressions applied to a different variable - Fixed bug with hashing in which a < could weirdly show up due to unhandled - sign in original string hash git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@1023 180e2498-e6e9-4542-8430-84ac67f01cd8 --- diff --git a/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java b/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java index 7102b55b..e233deff 100644 --- a/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java +++ b/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java @@ -352,7 +352,9 @@ public class CustomExpression implements Cloneable{ } public Double evaluateDouble(SimulationStatus status){ - return evaluate(status).getDoubleValue(); + double result = evaluate(status).getDoubleValue(); + if (result == Double.NEGATIVE_INFINITY || result == Double.POSITIVE_INFINITY) result = Double.NaN; + return result; } /* @@ -498,9 +500,10 @@ public class CustomExpression implements Cloneable{ * Used for temporary substitution when evaluating index and range expressions. */ public String hash(){ - Integer hashint = new Integer(this.getExpressionString().hashCode()); + Integer hashint = new Integer(this.getExpressionString().hashCode() + symbol.hashCode()); String hash = "$"; for (char c : hashint.toString().toCharArray()){ + if (c == '-') c = '0'; char newc = (char) (c + 17); hash = hash + newc; }