Pointer equality between Doubles does not seem like a good idea.

This commit is contained in:
Par Winzell
2009-04-13 17:28:37 +00:00
parent d860091612
commit 44789e36ee
@@ -145,8 +145,8 @@ public abstract class Arithmetic extends MultiOperator
@Override @Override
public Object evaluate (Object[] operands) public Object evaluate (Object[] operands)
{ {
for (int i = 1; i < operands.length; i ++) { for (int ii = 1; ii < operands.length; ii ++) {
if (NUMERICAL.apply(operands[i]) == Double.valueOf(0)) { if (Double.valueOf(0).equals(NUMERICAL.apply(operands[ii]))) {
return new NoValue("Division by zero in: " + StringUtil.toString(operands)); return new NoValue("Division by zero in: " + StringUtil.toString(operands));
} }
} }