module Factory.Math.Implementations.Pi.Ramanujan.Algorithm(
Algorithm(..)
) where
import qualified Factory.Math.Factorial as Math.Factorial
import qualified Factory.Math.Implementations.Pi.Ramanujan.Chudnovsky as Math.Implementations.Pi.Ramanujan.Chudnovsky
import qualified Factory.Math.Implementations.Pi.Ramanujan.Classic as Math.Implementations.Pi.Ramanujan.Classic
import qualified Factory.Math.Implementations.Pi.Ramanujan.Implementation as Math.Implementations.Pi.Ramanujan.Implementation
import qualified Factory.Math.Pi as Math.Pi
import qualified Factory.Math.SquareRoot as Math.SquareRoot
import qualified ToolShed.Defaultable
data Algorithm squareRootAlgorithm factorialAlgorithm =
Classic squareRootAlgorithm factorialAlgorithm
| Chudnovsky squareRootAlgorithm factorialAlgorithm
deriving (Eq, Read, Show)
instance (
ToolShed.Defaultable.Defaultable squareRootAlgorithm,
ToolShed.Defaultable.Defaultable factorialAlgorithm
) => ToolShed.Defaultable.Defaultable (Algorithm squareRootAlgorithm factorialAlgorithm) where
defaultValue = Chudnovsky ToolShed.Defaultable.defaultValue ToolShed.Defaultable.defaultValue
instance (
Math.SquareRoot.Algorithmic squareRootAlgorithm,
Math.Factorial.Algorithmic factorialAlgorithm
) => Math.Pi.Algorithmic (Algorithm squareRootAlgorithm factorialAlgorithm) where
openR (Classic squareRootAlgorithm factorialAlgorithm) = Math.Implementations.Pi.Ramanujan.Implementation.openR Math.Implementations.Pi.Ramanujan.Classic.series squareRootAlgorithm factorialAlgorithm
openR (Chudnovsky squareRootAlgorithm factorialAlgorithm) = Math.Implementations.Pi.Ramanujan.Implementation.openR Math.Implementations.Pi.Ramanujan.Chudnovsky.series squareRootAlgorithm factorialAlgorithm