Class ApproxAtan
- java.lang.Object
-
- com.metsci.glimpse.util.math.approx.ApproxAtan
-
public class ApproxAtan extends Object
Similar to the classes incom.metsci.glimpse.util.math.fast, but uses linear interpolation between samples instead of nearest-neighbor.Anecdotally, speed is about 7.5x faster than
Math.atan(double). With 100k samples, max error is around 1e-10. Max error decreases as the number of samples increases.Original domain is unbounded:
a = y / x a ∊ [ -inf, +inf ]Transform to bounded domain:
b = a / ( 1.0 + abs( a ) ) b ∊ [ -1, +1 ]Invert the transform to compute initial samples:
a = b / ( 1.0 - abs( b ) )
-
-
Constructor Summary
Constructors Constructor Description ApproxAtan(int numSamples)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleatan(double a)doubleatan2(double y, double x)static intrawSignBit(double d)
-