1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-01-17 12:25:20 +00:00

Change ceiling and floor to return NumberInterface. Add fractional part function. Add intValue function. Change StandardPlugin correspondingly.

This commit is contained in:
Arthur Drobot
2017-08-02 12:00:56 -07:00
parent c027a23dcb
commit 44ad5b3a6c
4 changed files with 60 additions and 12 deletions

View File

@@ -174,7 +174,7 @@ public class StandardPlugin extends Plugin {
//right and left refer to lhs and rhs in the above inequality.
NumberInterface sum = NaiveNumber.ONE.promoteTo(params[0].getClass());
NumberInterface nextNumerator = params[0];
NumberInterface left = params[0].multiply((new NaiveNumber(3)).promoteTo(params[0].getClass()).intPow(params[0].ceiling())), right = maxError;
NumberInterface left = params[0].multiply((new NaiveNumber(3)).promoteTo(params[0].getClass()).intPow(params[0].ceiling().intValue())), right = maxError;
do{
sum = sum.add(nextNumerator.divide(factorial(params[0].getClass(), n+1)));
n++;
@@ -434,7 +434,7 @@ public class StandardPlugin extends Plugin {
private static NumberInterface getSmallAngle(NumberInterface phi){
NumberInterface twoPi = getPi(phi.getClass()).multiply(new NaiveNumber("2").promoteTo(phi.getClass()));
NumberInterface theta = FUNCTION_ABS.apply(phi).subtract(twoPi
.multiply(new NaiveNumber(FUNCTION_ABS.apply(phi).divide(twoPi).floor()).promoteTo(phi.getClass()))); //Now theta is in [0, 2pi).
.multiply(FUNCTION_ABS.apply(phi).divide(twoPi))); //Now theta is in [0, 2pi).
if(phi.signum() < 0){
theta = twoPi.subtract(theta);
}