org.apfloat.samples
Class Pi.AbstractBinarySplittingPiCalculator

java.lang.Object
  extended by org.apfloat.samples.Pi.AbstractBinarySplittingPiCalculator
All Implemented Interfaces:
Serializable, Operation<Apfloat>
Direct Known Subclasses:
Pi.ChudnovskyPiCalculator, Pi.RamanujanPiCalculator
Enclosing class:
Pi

public abstract static class Pi.AbstractBinarySplittingPiCalculator
extends Object
implements Serializable, Operation<Apfloat>

Abstract base class for binary splitting algorithms.

See Also:
Serialized Form

Field Summary
protected  long precision
          Target precision.
protected  int radix
          Radix to be used.
 
Constructor Summary
protected Pi.AbstractBinarySplittingPiCalculator(long precision, int radix)
          Construct a pi calculator with the specified precision and radix.
 
Method Summary
protected abstract  Apfloat a(long n)
          Binary splitting term.
protected abstract  Apfloat p(long n)
          Binary splitting term.
protected abstract  Apfloat q(long n)
          Binary splitting term.
protected  void r(long n1, long n2, ApfloatHolder T, ApfloatHolder Q, ApfloatHolder P, Pi.BinarySplittingProgressIndicator progressIndicator)
          Entry point for the binary splitting algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apfloat.samples.Operation
execute
 

Field Detail

precision

protected long precision
Target precision.


radix

protected int radix
Radix to be used.

Constructor Detail

Pi.AbstractBinarySplittingPiCalculator

protected Pi.AbstractBinarySplittingPiCalculator(long precision,
                                                 int radix)
Construct a pi calculator with the specified precision and radix.

Parameters:
precision - The target precision.
radix - The radix to be used.
Method Detail

a

protected abstract Apfloat a(long n)
                      throws ApfloatRuntimeException
Binary splitting term.

Parameters:
n - The term.
Throws:
ApfloatRuntimeException

p

protected abstract Apfloat p(long n)
                      throws ApfloatRuntimeException
Binary splitting term.

Parameters:
n - The term.
Throws:
ApfloatRuntimeException

q

protected abstract Apfloat q(long n)
                      throws ApfloatRuntimeException
Binary splitting term.

Parameters:
n - The term.
Throws:
ApfloatRuntimeException

r

protected void r(long n1,
                 long n2,
                 ApfloatHolder T,
                 ApfloatHolder Q,
                 ApfloatHolder P,
                 Pi.BinarySplittingProgressIndicator progressIndicator)
          throws ApfloatRuntimeException
Entry point for the binary splitting algorithm.

Parameters:
n1 - Start term.
n2 - End term.
T - Algorithm parameter.
Q - Algorithm parameter.
P - Algorithm parameter.
progressIndicator - Class to print out the progress of the calculation.
Throws:
ApfloatRuntimeException