Add sqrt function.

This commit is contained in:
Arthur Drobot 2017-07-27 13:47:51 -07:00
parent 557bc66e53
commit 088a45cf4c
1 changed files with 12 additions and 0 deletions

View File

@ -220,6 +220,18 @@ public class StandardPlugin extends Plugin {
return StandardPlugin.this.getFunction("exp").apply(StandardPlugin.this.getFunction("ln").apply(params[0]).multiply(params[1]));
}
});
registerFunction("sqrt", new Function() {
@Override
protected boolean matchesParams(NumberInterface[] params) {
return params.length == 1;
}
@Override
protected NumberInterface applyInternal(NumberInterface[] params) {
return StandardPlugin.this.getFunction("pow").apply(params[0], (new NaiveNumber(0.5)));
}
});
}
/**