[ algorithms, data, library, math, mit ] [ Propose Tags ]

A library for exact computation with quadratic irrationals with support for exact conversion from and to (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 (the golden ratio),

• solutions to quadratic equations with rational constants – the 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, …]

Versions [faq] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6 ChangeLog.md arithmoi (>=0.4), base (>=4.8 && <5), containers (>=0.5 && <0.7), mtl (>=2.1 && <2.3), transformers (>=0.3 && <0.6) [details] MIT Copyright © 2014 Johan Kiviniemi Johan Kiviniemi Andrew Lelechenko andrew dot lelechenko at gmail dot com Revision 1 made by Bodigrim at Mon Dec 3 23:46:54 UTC 2018 Math, Algorithms, Data https://github.com/ion1/quadratic-irrational https://github.com/ion1/quadratic-irrational/issues head: git clone https://github.com/ion1/quadratic-irrational.git by Bodigrim at Wed Aug 29 18:26:30 UTC 2018 LTSHaskell:0.0.6, NixOS:0.0.6, Stackage:0.0.6 2283 total (107 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs available Last success reported on 2018-08-29

## Modules

[Index] [Quick Jump]

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

# quadratic-irrational

A library for exact computation with quadratic irrationals with support for exact conversion from and to (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 (the golden ratio),

• solutions to quadratic equations with rational constants – the quadratic formula has a familiar shape.

A simple continued fraction is a number 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, …]