ch.obermuhlner.math.big.internal.AtanhCalculator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of big-math Show documentation
Show all versions of big-math Show documentation
Math functions for BigDecimal.
package ch.obermuhlner.math.big.internal;
import ch.obermuhlner.math.big.BigRational;
import java.math.BigDecimal;
import java.math.MathContext;
/**
* Calculates sinus hyperbolicus using the Taylor series.
*
*
*
* No argument checking or optimizations are done.
* This implementation is not intended to be called directly.
*/
public class AtanhCalculator extends SeriesCalculator {
public static final AtanhCalculator INSTANCE = new AtanhCalculator();
private int n = 0;
private AtanhCalculator() {
super(true);
}
@Override
protected BigRational getCurrentFactor() {
return BigRational.valueOf(1, 2 * n + 1);
}
@Override
protected void calculateNextFactor() {
n++;
}
@Override
protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) {
return new PowerTwoNPlusOneIterator(x, mathContext);
}
}