From 8215f3e98cf887a32d4f11a6c96d1037ef00c01a Mon Sep 17 00:00:00 2001 From: Arthur Drobot Date: Fri, 4 Aug 2017 10:05:18 -0700 Subject: [PATCH] Add argument checks in division and natural log. --- src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java b/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java index d7b14f3..6cbc4e8 100755 --- a/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java +++ b/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java @@ -90,7 +90,7 @@ 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 == 2; + return params.length == 2 && params[1].compareTo(NaiveNumber.ZERO.promoteTo(params[1].getClass())) != 0; } @Override @@ -204,7 +204,7 @@ public class StandardPlugin extends Plugin { public static final Function FUNCTION_LN = new Function() { @Override protected boolean matchesParams(NumberInterface[] params) { - return params.length == 1; + return params.length == 1 && params[0].compareTo(NaiveNumber.ZERO.promoteTo(params[0].getClass())) > 0; } @Override