module Factory.Math.Implementations.Pi.Ramanujan.Implementation(
openR
) where
import qualified Control.Parallel.Strategies
import qualified Factory.Math.Implementations.Pi.Ramanujan.Series as Math.Implementations.Pi.Ramanujan.Series
import qualified Factory.Math.Precision as Math.Precision
import qualified Factory.Math.Summation as Math.Summation
openR
:: Math.Implementations.Pi.Ramanujan.Series.Series squareRootAlgorithm factorialAlgorithm
-> squareRootAlgorithm
-> factorialAlgorithm
-> Math.Precision.DecimalDigits
-> Rational
openR Math.Implementations.Pi.Ramanujan.Series.MkSeries {
Math.Implementations.Pi.Ramanujan.Series.terms = terms,
Math.Implementations.Pi.Ramanujan.Series.getSeriesScalingFactor = getSeriesScalingFactor,
Math.Implementations.Pi.Ramanujan.Series.convergenceRate = convergenceRate
} squareRootAlgorithm factorialAlgorithm decimalDigits = uncurry (/) $ Control.Parallel.Strategies.withStrategy (
Control.Parallel.Strategies.parTuple2 Control.Parallel.Strategies.rdeepseq Control.Parallel.Strategies.rdeepseq
) (
getSeriesScalingFactor squareRootAlgorithm decimalDigits,
Math.Summation.sumR 64 . take (
Math.Precision.getTermsRequired convergenceRate decimalDigits
) $ terms factorialAlgorithm
)