Package org.apfloat.samples

Sample applications demonstrating apfloat use.

See:
          Description

Interface Summary
Operation Interface for implementing arbitrary operations to be executed.
OperationExecutor Interface for implementing objects that can execute Operations.
 

Class Summary
ApfloatHolder Simple JavaBean to hold one Apfloat.
BackgroundOperation Class for running an Operation in the background in a separate thread.
LocalOperationExecutor Class to execute Operations locally.
OperationServer Server for executing Operations from remote calls.
Pi Calculates pi using three different algorithms.
Pi.BorweinPiCalculator Calculates pi using the Borweins' quartic algorithm.
Pi.ChudnovskyPiCalculator Basic class for calculating pi using the Chudnovskys' binary splitting algorithm.
Pi.ChudnovskyProgressIndicator Indicates progress of the pi calculation using the Chudnovskys' binary splitting algorithm.
Pi.GaussLegendrePiCalculator Calculates pi using the Gauss-Legendre algorithm.
PiApplet Applet for calculating pi using three different algorithms.
PiDistributed Calculates pi using a cluster of servers.
PiDistributed.DistributedPiCalculator Distributed version of the Chudnovskys' binary splitting algorithm.
PiParallel Calculates pi using multiple threads in parallel.
PiParallel.ParallelPiCalculator Parallel version of the Chudnovskys' binary splitting algorithm.
PiParallel.ThreadLimitedOperation Class to execute operations while setting ApfloatContext.setNumberOfProcessors(int) to some value.
PiParallelApplet Applet for calculating pi using multiple threads in parallel.
RemoteOperationExecutor Class to call an OperationServer to execute Operations remotely.
 

Package org.apfloat.samples Description

Sample applications demonstrating apfloat use.

Three different versions of an application for calculating π are included. The simplest, Pi runs on one computer using one processor (and thread) only. PiParallel executes multiple threads in parallel and has vastly better performance on symmetric multiprocessor (SMP) computers. Finally, PiDistributed can use multiple separate computers for calculating pi for even greater calculating power.

As a curiosity, two applets are provided for running Pi and PiParallel through a graphical user interface: PiApplet and PiParallelApplet, correspondingly.

Compared to the C++ version of apfloat, the Java version pi calculation program does fairly well. It achieves roughly 50% of the performance of the assembler-optimized C++ versions of apfloat. But, compared to the plain ANSI C++ version the Java version can be as much as 25% faster! This truely shows that adaptive compilation from an intermediate binary executable format is a better solution than direct compilation to a single native format.