[racket] Racket Question
On Friday, March 30, 2012, Brandon T wrote:
> Hi i have a question that i could not find an answer to on your site, not
> could i find an answer on stack overload. By default, racket prints the
> first 25 digits of a irrational fraction. i.e.
>
> >1/998
> 0.0010020040080160320641282...
>
>
Just to point out that 1/998 is not irrational. It has a finite decimal
representation. See:
http://en.wikipedia.org/wiki/Repeating_decimal
We can can compute the repeating decimal representation of a fraction by
repeated division on the remainders, and since there are only a finite
number of distinct remainders of 998, we're guaranteed to terminate at some
point, or find a loop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120330/559be3eb/attachment.html>