Package ch.obermuhlner.math.big.internal
Interface PowerIterator
- All Known Implementing Classes:
PowerNIterator
,PowerTwoNIterator
,PowerTwoNMinusOneIterator
,PowerTwoNPlusOneIterator
public interface PowerIterator
Iterator over the powers of a value x.
This API allows to efficiently calculate the various powers of x in a taylor series by storing intermediate results.
For example xn can be calculated using one multiplication by storing the previously calculated xn-1 and x.
getCurrentPower()
will be called first to retrieve the initial value.
calculateNextPower()
will be called before getCurrentPower()
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Calculates the next power.Returns the current power.
-
Method Details
-
getCurrentPower
BigDecimal getCurrentPower()Returns the current power.- Returns:
- the current power.
-
calculateNextPower
void calculateNextPower()Calculates the next power.
-