Jump to content

Arithmetic-geometric mean/Calculate Pi: Difference between revisions

m
Line 1,211:
# Compute pi to one million decimal digits:
p <- 3322000
x <- agm(20, p)
roundMpfr(agm(20, p) - Const("pi", p), 64)
 
# Check
roundMpfr(agm(20, p)x - Const("pi", p), 64)
# 1 'mpfr' number of precision 64 bits
# [1] 4.90382361286485830568e-1000016</lang>
 
# Save to disk
f <- file("pi.txt", "w")
writeLines(formatMpfr(x, 1e6), f)
close(f)</lang>
 
=={{header|Racket}}==
1,336

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.