diff --git a/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java b/core/src/net/sf/openrocket/simulation/customexpression/CustomExpression.java index 7102b55be..e233deff9 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; }