| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Factory.Math.Pi
Contents
Description
AUTHOR- Dr. Alistair Ward
DESCRIPTION- Defines the classes of Pi-algorithm which have been implemented.
Synopsis
- class Algorithmic algorithm where
- openR :: algorithm -> DecimalDigits -> Rational
- openI :: algorithm -> DecimalDigits -> Integer
- openS :: algorithm -> DecimalDigits -> String
- data Category agm bbp borwein ramanujan spigot
Type-classes
class Algorithmic algorithm where Source #
- Defines the methods expected of a Pi-algorithm.
- Most of the implementations naturally return a
Rational, but the spigot-algorithms naturally produce a[Int]; though representing Pi as a big integer with the decimal point removed is clearly incorrect. - Since representing Pi as either a
Rationalor promoted to anInteger, is inconvenient, an alternative decimalString-representation is provided.
Minimal complete definition
Methods
Arguments
| :: algorithm | |
| -> DecimalDigits | |
| -> Rational | Returns the value of Pi as a |
Arguments
| :: algorithm | |
| -> DecimalDigits | |
| -> Integer | Returns the value of Pi, promoted by the required precision to form an integer. |
Arguments
| :: algorithm | |
| -> DecimalDigits | |
| -> String | Returns the value of Pi as a decimal |
Instances
| Algorithmic Algorithm Source # | |
| Algorithmic Algorithm Source # | |
| Algorithmic squareRootAlgorithm => Algorithmic (Algorithm squareRootAlgorithm) Source # | |
| (Algorithmic squareRootAlgorithm, Algorithmic factorialAlgorithm) => Algorithmic (Algorithm squareRootAlgorithm factorialAlgorithm) Source # | |
| (Algorithmic squareRootAlgorithm, Algorithmic factorialAlgorithm) => Algorithmic (Algorithm squareRootAlgorithm factorialAlgorithm) Source # | |
| (Algorithmic agm, Algorithmic bbp, Algorithmic borwein, Algorithmic ramanujan, Algorithmic spigot) => Algorithmic (Category agm bbp borwein ramanujan spigot) Source # | |
Defined in Factory.Math.Pi | |
Types
Data-types
data Category agm bbp borwein ramanujan spigot Source #
Categorises the various algorithms.
Constructors
| AGM agm | Algorithms based on the Arithmetic-geometric Mean. |
| BBP bbp | https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula. |
| Borwein borwein | |
| Ramanujan ramanujan | |
| Spigot spigot | Algorithms from which the digits of Pi slowly drip, one by one. |
Instances
| (Eq agm, Eq bbp, Eq borwein, Eq ramanujan, Eq spigot) => Eq (Category agm bbp borwein ramanujan spigot) Source # | |
| (Read agm, Read bbp, Read borwein, Read ramanujan, Read spigot) => Read (Category agm bbp borwein ramanujan spigot) Source # | |
Defined in Factory.Math.Pi | |
| (Show agm, Show bbp, Show borwein, Show ramanujan, Show spigot) => Show (Category agm bbp borwein ramanujan spigot) Source # | |
| Default bbp => Default (Category agm bbp borwein ramanujan spigot) Source # | |
Defined in Factory.Math.Pi | |
| (Algorithmic agm, Algorithmic bbp, Algorithmic borwein, Algorithmic ramanujan, Algorithmic spigot) => Algorithmic (Category agm bbp borwein ramanujan spigot) Source # | |
Defined in Factory.Math.Pi | |