# Class PiParallel

java.lang.Object
org.apfloat.samples.Pi
org.apfloat.samples.PiParallel

Direct Known Subclasses:
  `PiDistributed`

public class PiParallel extends Pi
Calculates pi using multiple threads in parallel.

Note that to get any performance gain from running many threads in parallel, the JVM must be executing native threads. If the JVM is running in green threads mode, there is no advantage of having multiple threads, as the JVM will in fact execute just one thread and divide its time to multiple simulated threads.

Version:
  1.14.0
Author:
  Mikko Tommila

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `PiParallel.ParallelBinarySplittingPiCalculator`
  Parallel version of the binary splitting algorithm.
  `static class`
  `PiParallel.ParallelChudnovskyPiCalculator`
  Class for calculating pi using the parallel Chudnovskys' binary splitting algorithm.
  `static class`
  `PiParallel.ParallelRamanujanPiCalculator`
  Class for calculating pi using the parallel Ramanujan's binary splitting algorithm.
  `protected static class`
  `PiParallel.ThreadLimitedOperation<T>`
  Class to execute operations while setting `ApfloatContext.setNumberOfProcessors(int)` to some value.

  ### Nested classes/interfaces inherited from class Pi

  `Pi.AbstractBinarySplittingSeries, Pi.BinarySplittingPiCalculator, Pi.BinarySplittingProgressIndicator, Pi.BinarySplittingSeries, Pi.BorweinPiCalculator, Pi.ChudnovskyBinarySplittingSeries, Pi.ChudnovskyPiCalculator, Pi.GaussLegendrePiCalculator, Pi.RamanujanBinarySplittingSeries, Pi.RamanujanPiCalculator`

- ## Field Summary

  ### Fields inherited from class Pi

  `err, out`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `main(String[] args)`
  Command-line entry point.

  ### Methods inherited from class Pi

  `getErr, getInt, getLong, getOut, getPrecision, getRadix, run, setErr, setOut`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### main

    public static void main(String[] args) throws IOException, ApfloatRuntimeException
    Command-line entry point.
    Parameters:
      `args` - Command-line parameters.
    Throws:
      `IOException` - In case writing the output fails.
      `ApfloatRuntimeException`