From 2b4da2a1ff13e1e3c191e37f567e8f48627fc447 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 2 Aug 2017 11:28:49 -0700 Subject: [PATCH] Fix division to not multiply numbers. --- src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java b/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java index aeed916..cc379d5 100755 --- a/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java +++ b/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java @@ -76,16 +76,12 @@ public class StandardPlugin extends Plugin { public static final Operator OP_DIVIDE = new Operator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 1, new Function() { @Override protected boolean matchesParams(NumberInterface[] params) { - return params.length >= 1; + return params.length == 2; } @Override protected NumberInterface applyInternal(NumberInterface[] params) { - NumberInterface product = params[0]; - for (int i = 1; i < params.length; i++) { - product = product.multiply(params[i]); - } - return product; + return params[0].divide(params[1]); } }); /**