From 955bd4c04d023ed6d9df4070ab0c27f56f4806aa Mon Sep 17 00:00:00 2001 From: Arthur Drobot Date: Wed, 2 Aug 2017 13:27:39 -0700 Subject: [PATCH] Remember to use floor in the angle reduction function. Comment debugging output. --- src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java | 5 +++-- 1 file changed, 3 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 0c79115..3db5c1a 100755 --- a/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java +++ b/src/main/java/org/nwapw/abacus/plugin/StandardPlugin.java @@ -293,13 +293,14 @@ public class StandardPlugin extends Plugin { NumberInterface pi = getPi(params[0].getClass()); NumberInterface twoPi = pi.multiply(new NaiveNumber(2).promoteTo(pi.getClass())); NumberInterface theta = getSmallAngle(params[0]); + //System.out.println(theta); if(theta.compareTo(pi.multiply(new NaiveNumber(1.5).promoteTo(twoPi.getClass()))) >= 0){ theta = theta.subtract(twoPi); } else if(theta.compareTo(pi.divide(new NaiveNumber(2).promoteTo(pi.getClass()))) > 0){ theta = pi.subtract(theta); } - System.out.println(theta); + //System.out.println(theta); return sinTaylor(theta); } }; @@ -434,7 +435,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(FUNCTION_ABS.apply(phi).divide(twoPi))); //Now theta is in [0, 2pi). + .multiply(FUNCTION_ABS.apply(phi).divide(twoPi).floor())); //Now theta is in [0, 2pi). if(phi.signum() < 0){ theta = twoPi.subtract(theta); }