quadratic-irrational (hackage): 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  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  or alternatively written as  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.
Keywords: algorithms|data|library|math|mit