Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- continuedFraction :: (RealFrac a, Integral b) => a -> [b]
- collapseFraction :: (Integral a, Integral b) => NonEmpty b -> Ratio a
- approximate :: (RealFrac a, Integral b) => a -> b -> Ratio b
- convergent :: (RealFrac a, Integral b) => Int -> a -> Ratio b
Conversion between numbers and continued fractions
continuedFraction :: (RealFrac a, Integral b) => a -> [b] Source #
This take a number and returns its continued fraction expansion as a list of Integer
s.
>>>
continuedFraction 2
[2]
collapseFraction :: (Integral a, Integral b) => NonEmpty b -> Ratio a Source #
Take a non-empty list of integers and return the corresponding rational number.
>>>
collapseFraction (1 :| [2,2,2])
17 % 12