Pidec implements an algorithm to compute single decimals of the sequence of π digits, using only a small amount of memory.
This work is based on Fabrice Bellard's paper and his published code can be found here.
The implementation is in the module main.rkt
, while its tests are defined in
test-main.rkt
. The first one is written in Typed Racket, while the second one
is plain Racket. Apparently, Typed Racket does not support defining tests in
submodules of the same file as the implementation.
You will need to have Racket > 6.1 installed. Use Racket's built-in package manager:
$ raco pkg install pidec
Compile the code with raco
, and execute it passing a single number, which is
the starting position for 10 π decimal places.
$ raco exe bellard.rkt
$ ./bellard 50
Pass the tests with raco
$ raco test test-bellard.rkt
These module are licensed under the MIT license. See LICENSE for details.
Sebastián Ortega (sortega)