Class Pi.GaussLegendrePiCalculator

  • All Implemented Interfaces:
    java.io.Serializable, Operation<Apfloat>
    Enclosing class:
    Pi

    public static class Pi.GaussLegendrePiCalculator
    extends java.lang.Object
    implements Operation<Apfloat>
    Calculates pi using the Gauss-Legendre algorithm.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      GaussLegendrePiCalculator​(long precision, int radix)
      Construct a pi calculator with the specified precision and radix.
    • Field Detail

      • precision

        private long precision
      • radix

        private int radix
    • Constructor Detail

      • GaussLegendrePiCalculator

        public GaussLegendrePiCalculator​(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

      • execute

        public Apfloat execute()
        Calculate pi using the Gauss-Legendre iteration.
        Specified by:
        execute in interface Operation<Apfloat>
        Returns:
        Return value of the operation.
      • gaussLegendrePrecision

        private static long gaussLegendrePrecision​(int k,
                                                   int r,
                                                   int radix)