BBP.frink

Download or view BBP.frink in plain text format


// Implements the Bailey-Borwein-Plouffe algorithm to find the hexadecimal
// digits of pi.
//
// http://crd.lbl.gov/~dhbailey/

setPrecision[100]

pi = 0
for k = 0 to 100
{
   k8 = 8k
   term = 4/(k8 +1) - 2/(k8 + 4) - 1/(k8 + 5) - 1/(k8 + 6)
   pi = pi + 16^-k term
   println["$term\t" + 1. * pi]
}


Download or view BBP.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19355 days, 22 hours, 24 minutes ago.