Continued fraction/Arithmetic/G(matrix ng, continued fraction n): Difference between revisions

Line 4,292:
 
One might note that a lazy list automatically memoizes terms, but not with O(1) access times.
 
The continued fraction generated here for sqrt(2) is actually the continued fraction for a close rational approximation to sqrt(2). I borrowed the definition along with that of '''real2cf'''. The approximation is probably ''not'' what you would want in a practical application, but I thought the definition was cool, and did not feel like being pedantic (until I wrote this commentary). :)
 
<syntaxhighlight lang="haskell">
1,448

edits