name: quadratic-irrational
category: Math, Algorithms, Data
version: 0.0.4
license: MIT
license-file: LICENSE
author: Johan Kiviniemi <devel@johan.kiviniemi.name>
maintainer: Johan Kiviniemi <devel@johan.kiviniemi.name>
stability: provisional
homepage: https://github.com/ion1/quadratic-irrational
bug-reports: https://github.com/ion1/quadratic-irrational/issues
copyright: Copyright © 2014 Johan Kiviniemi
synopsis: An implementation of quadratic irrationals
description:
A library for exact computation with
<http://en.wikipedia.org/wiki/Quadratic_irrational quadratic irrationals>
with support for exact conversion from and to
<http://en.wikipedia.org/wiki/Periodic_continued_fraction (potentially periodic) simple continued fractions>.
.
A quadratic irrational is a number that can be expressed in the form
.
> (a + b √c) / d
.
where @a@, @b@ and @d@ are integers and @c@ is a square-free natural number.
.
Some examples of such numbers are
.
* @7/2@,
.
* @√2@,
.
* @(1 + √5)\/2@
(<http://en.wikipedia.org/wiki/Golden_ratio the golden ratio>),
.
* solutions to quadratic equations with rational constants – the
<http://en.wikipedia.org/wiki/Quadratic_formula quadratic formula> has a
familiar shape.
.
A simple continued fraction is a number expressed in the form
.
> a + 1/(b + 1/(c + 1/(d + 1/(e + …))))
.
or alternatively written as
.
> [a; b, c, d, e, …]
.
where @a@ is an integer and @b@, @c@, @d@, @e@, … are positive integers.
.
Every finite SCF represents a rational number and every infinite, periodic
SCF represents a quadratic irrational.
.
> 3.5 = [3; 2]
> (1+√5)/2 = [1; 1, 1, 1, …]
> √2 = [1; 2, 2, 2, …]
tested-with: GHC == 7.6.3
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
.gitignore
.travis.yml
ChangeLog.md
README.md
source-repository head
type: git
location: https://github.com/ion1/quadratic-irrational.git
library
exposed-modules: Numeric.QuadraticIrrational
, Numeric.QuadraticIrrational.CyclicList
, Numeric.QuadraticIrrational.Internal.Lens
hs-source-dirs: src
build-depends: base >= 4.6 && < 4.8
, arithmoi == 0.4.*
, containers == 0.5.*
, mtl == 2.1.*
, transformers == 0.3.*
default-language: Haskell2010
ghc-options: -Wall -O2 -funbox-strict-fields
test-suite tasty-tests
type: exitcode-stdio-1.0
main-is: tasty.hs
other-modules: QuadraticIrrational
, CyclicList
hs-source-dirs: tests
build-depends: base
, quadratic-irrational
, numbers == 3000.*
, QuickCheck >= 2.7 && < 3
, tasty == 0.8.*
, tasty-quickcheck == 0.8.*
default-language: Haskell2010
ghc-options: -Wall -O2 -funbox-strict-fields
test-suite doctests
type: exitcode-stdio-1.0
main-is: doctests.hs
hs-source-dirs: tests
build-depends: base
, directory
, doctest >= 0.9
, filepath
, mtl
, numbers
default-language: Haskell2010
ghc-options: -threaded -Wall