name: quadratic-irrational
category: Math, Algorithms, Data
version: 0.1.1
x-revision: 2
license: MIT
license-file: LICENSE
author: Johan Kiviniemi <devel@johan.kiviniemi.name>
maintainer: Andrew Lelechenko andrew dot lelechenko at gmail dot com
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==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.3, GHC==8.10.1

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
  other-modules:   Numeric.QuadraticIrrational.SquareFree
                 , Numeric.QuadraticIrrational.Ring
  hs-source-dirs: src
  build-depends: base >= 4.9 && < 5
               , arithmoi >= 0.9
               , containers >= 0.5 && < 0.8
               , integer-roots >= 1.0
               , transformers >= 0.3 && < 0.7
  if impl(ghc <8.0)
    build-depends:
      semigroups >=0.8
  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.0 && < 3000.3
               , QuickCheck >= 2.7 && < 3
               , tasty >= 0.8
               , tasty-quickcheck >= 0.8 && < 0.11
  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
               , arithmoi
  default-language: Haskell2010
  ghc-options: -threaded -Wall