From 950e3503b7136c806352001f67c456a9f34695d9 Mon Sep 17 00:00:00 2001 From: Arthur Drobot Date: Thu, 27 Jul 2017 13:17:22 -0700 Subject: [PATCH] Add pow function. --- src/org/nwapw/abacus/plugin/StandardPlugin.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/org/nwapw/abacus/plugin/StandardPlugin.java b/src/org/nwapw/abacus/plugin/StandardPlugin.java index 5772762..d48beb7 100755 --- a/src/org/nwapw/abacus/plugin/StandardPlugin.java +++ b/src/org/nwapw/abacus/plugin/StandardPlugin.java @@ -201,6 +201,18 @@ public class StandardPlugin extends Plugin { return sum; } }); + + registerFunction("pow", new Function() { + @Override + protected boolean matchesParams(NumberInterface[] params) { + return params.length == 2; + } + + @Override + protected NumberInterface applyInternal(NumberInterface[] params) { + return StandardPlugin.this.getFunction("exp").apply(StandardPlugin.this.getFunction("ln").apply(params[0]).multiply(params[1])); + } + }); } /**