1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-07-22 21:36:33 -07:00

Add sqrt function.

This commit is contained in:
Arthur Drobot 2017-07-27 13:47:51 -07:00
parent 22f8a48195
commit 8fb82e1fb8

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)));
}
});
}
/**