// 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] }