具有讽刺意味的是,这将需要BigReal类型;我们有.Net这个吗? .Net 4.0有BigInteger.
有人有Haskell版本吗?
解决方法
This paper is an atypical exercice in
lazy functional coding,written for
fun and instruction. It can be read
and understood by anybody who
understands the programming language
Haskell. We show how to implement the
Bailey-Borwein-Ploue formula for π
in a co-recursive,incremental way
which produces the digits 3,1,4,
5,9. . . until the memory
exhaustion. This is not a way to
proceed if somebody needs many
digits! Our coding strategy is
perverse and dangerous,and it
provably breaks down. It is based on
the arithmetics over the domain of
infinite sequences of digits
representing proper fractions expanded
in an integer base. We show how to
manipulate: add,multiply by an
integer,etc. such sequences from the
left to the right ad infinitum,
which obvIoUsly cannot work in all
cases because of ambiguities. Some
deep philosophical consequences are
discussed in the conclusions.
它并没有以高效或非常实用的方式真正解决问题,而是娱乐性并且展示了懒惰无限精度算法的一些问题.