org.apfloat.samples
Class Pi.ChudnovskyPiCalculator

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

public static class Pi.ChudnovskyPiCalculator
extends Object
implements Operation<Apfloat>

Basic class for calculating pi using the Chudnovskys' binary splitting algorithm.

See Also:
Serialized Form

Constructor Summary
  Pi.ChudnovskyPiCalculator(long precision, int radix)
          Construct a pi calculator with the specified precision and radix.
protected Pi.ChudnovskyPiCalculator(Pi.BinarySplittingPiCalculator calculator, long precision, int radix)
          Construct a pi calculator with the specified binary splitting algorithm.
 
Method Summary
 Apfloat execute()
          Calculate pi using the Chudnovskys' binary splitting algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pi.ChudnovskyPiCalculator

public Pi.ChudnovskyPiCalculator(long precision,
                                 int radix)
                          throws ApfloatRuntimeException
Construct a pi calculator with the specified precision and radix.

Parameters:
precision - The target precision.
radix - The radix to be used.
Throws:
ApfloatRuntimeException

Pi.ChudnovskyPiCalculator

protected Pi.ChudnovskyPiCalculator(Pi.BinarySplittingPiCalculator calculator,
                                    long precision,
                                    int radix)
                             throws ApfloatRuntimeException
Construct a pi calculator with the specified binary splitting algorithm.

Parameters:
calculator - The binary splitting algorithm to be used.
precision - The target precision.
radix - The radix to be used.
Throws:
ApfloatRuntimeException
Method Detail

execute

public Apfloat execute()
Calculate pi using the Chudnovskys' binary splitting algorithm.

Specified by:
execute in interface Operation<Apfloat>
Returns:
Return value of the operation.