This is a package to calculate PI in huge digits. I programmed it for a benchmark of a FFT based multiple-precision routine.
Makefile : make file - for 32bit CPU: digits <= 6,000,000,000 Makefile_64bit : make file - for 64bit CPU Makefile_quad : make file - for 128bit FPU config.h : machine depending macros fftsgx.c : FFT Package in C - split-radix - use work areas fftsg_hx.c : FFT Package in C - split-radix - use no work areas pi_fftca.c : PI Calc. Program - standard version - use fft*gx.c" pi_fftcs.c : PI Calc. Program - mem save version - use "fft*g_hx.c" pi_fftcw.c : PI Calc. Program - mem swap version - use "fft*g_hx.c" dgt_div.c : data converter - from pi.dat to Super_PI format README.TXT : readme file win32bin/ : DIR win32bin/Makefile : make file - for intel C++ compiler win32bin/pi_cs.exe : Win32 exec. - mem save version win32bin/pi_cs_thread.exe : Win32 exec. - use FFT level threads win32bin/pi_cw.exe : Win32 exec. - mem swap version win32bin/pi_cw_thread.exe : Win32 exec. - use FFT level threads win32bin/dgt_div.exe : data converter - pi.dat => pi.txt a printout format
Check macros in "config.h" and modify if necessary. FFT_ERROR_MARGIN is very impotant parameter. If FFT_ERROR_MARGIN is very small then efficiency will be bad. If FFT_ERROR_MARGIN >= 0.5 then it may calculate a wrong result.
1,048,576 digits |
16,777,216 digits |
134,217,728 digits |
|
---|---|---|---|
pi_cas5 (pi_fftca.c + fftsg.c) |
54 sec. | 1323 sec. (22 min.) | - |
pi_css5 (pi_fftcs.c + fftsg_h.c) |
48 sec. | 1189 sec. (19 min.) | - |
pi_cws5 (pi_fftcw.c + fftsg_h.c) |
71 sec. total [65 sec. cpu] |
1702 sec. (28 min.) total [1563 sec. (26 min.) cpu] |
23533 sec. (6 h. 32 min.) total [15748 sec. (4 h. 22 min.) cpu] |
Super_PI@Kanada Lab. | 237 sec. total | 5440 sec. (90 min.) total | - |
1,048,576 digits |
16,777,216 digits |
|
---|---|---|
pi_cas5 (pi_fftca.c + fftsg.c) |
77 sec. | 2406 sec. (40 min) |
pi_css5 (pi_fftcs.c + fftsg_h.c) |
81 sec. | 2505 sec. (41 min.) |
---- Relationship between Number of Digits and FFT Length ----
ndigit = nfft*log_10(R), R >= 10000 or 1000
R is a radix of multiple-precision format. R depends on DBL_ERROR_MARGIN and FFT+machine+compiler's tolerance.
---- a formula based on the AGM (Arithmetic-Geometric Mean) ---- c = sqrt(0.125); a = 1 + 3 * c; b = sqrt(a); e = b - 0.625; b = 2 * b; c = e - c; a = a + e; npow = 4; do { npow = 2 * npow; e = (a + b) / 2; b = sqrt(a * b); e = e - b; b = 2 * b; c = c - e; a = e + b; } while (e > SQRT_SQRT_EPSILON); e = e * e / 4; a = a + b; pi = (a * a - e - e / 2) / (a * c - e) / npow; ---- modification ---- This is a modified version of Gauss-Legendre formula (by T.Ooura). It is faster than original version.