Class Pi.BorweinPiCalculator

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

    public static class Pi.BorweinPiCalculator
    extends java.lang.Object
    implements Operation<Apfloat>
    Calculates pi using the Borweins' quartic algorithm.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      BorweinPiCalculator​(long precision, int radix)
      Construct a pi calculator with the specified precision and radix.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static long borweinPrecision​(int k, int r, int radix)  
      Apfloat execute()
      Calculate pi using the Borweins' quartic iteration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • precision

        private long precision
      • radix

        private int radix
    • Constructor Detail

      • BorweinPiCalculator

        public BorweinPiCalculator​(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 Borweins' quartic iteration.
        Specified by:
        execute in interface Operation<Apfloat>
        Returns:
        Return value of the operation.
      • borweinPrecision

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