module Factory.Math.Implementations.Pi.Borwein.Implementation(
openR
) where
import qualified Control.Arrow
import qualified Data.Ratio
import qualified Factory.Math.Implementations.Pi.Borwein.Series as Math.Implementations.Pi.Borwein.Series
import qualified Factory.Math.Precision as Math.Precision
#if MIN_VERSION_parallel(3,0,0)
import qualified Control.Parallel.Strategies
#endif
openR
:: Math.Implementations.Pi.Borwein.Series.Series squareRootAlgorithm factorialAlgorithm
-> squareRootAlgorithm
-> factorialAlgorithm
-> Math.Precision.DecimalDigits
-> Data.Ratio.Rational
openR Math.Implementations.Pi.Borwein.Series.MkSeries {
Math.Implementations.Pi.Borwein.Series.terms = terms,
Math.Implementations.Pi.Borwein.Series.convergenceRate = convergenceRate
} squareRootAlgorithm factorialAlgorithm decimalDigits = uncurry (/)
#if MIN_VERSION_parallel(3,0,0)
. Control.Parallel.Strategies.withStrategy (Control.Parallel.Strategies.parTuple2 Control.Parallel.Strategies.rdeepseq Control.Parallel.Strategies.rdeepseq)
#endif
. Control.Arrow.second (
sum . take (
Math.Precision.getTermsRequired convergenceRate decimalDigits
)
) $ terms squareRootAlgorithm factorialAlgorithm decimalDigits