>> pi_test 28-Feb-2012 10:21:24 PI_TEST MATLAB version. Test MATLAB's variable precision arithmetic (VPA) facility by computing PI. AGM_PI_TEST AGM_PI computes the value of pi using the arithmetic-geometric-mean approach. Request PI to 10, 20, 40, 80 digits. Digits PI: [ 10, 3.141592654] [ 20, 3.1415926535897932385] [ 40, 3.141592653589793238462643383279502884197] [ 80, 3.141592653589793238462643383279502884197169399375105820974944592307816406286209] How long does it take to compute PI to D digits? Digits Seconds 1 2 0.0167432 2 4 0.0205585 3 8 0.0273093 4 16 0.0305305 5 32 0.0385192 6 64 0.042957 7 128 0.0462043 8 256 0.048097 9 512 0.0555786 10 1024 0.0803591 11 2048 0.0666595 12 4096 0.0721937 13 8192 0.0781427 14 16384 0.141312 15 32768 0.209662 16 65536 0.338586 17 131072 0.706382 18 262144 3.71041 19 524288 6.56125 20 1048576 14.4048 BBP_PI_TEST BBP_PI can compute 13 hexadecimal digits at a time in the value of pi using the Bailey-Borwein-Plouffe approach. Usually the first 11 or 12 digits are accurate. Request PI to 10, 20, 40, 80 hexadecimal digits. Digits PI: 0: 9 243F6A8885 0:19 243F6A8885A308D31319 0:29 243F6A8885A308D313198A2E037073 0:39 243F6A8885A308D313198A2E03707344A4093822 Correct hexadecimal representation of pi to 80 hexadecimal digits: 1 2 3 4 5 6 7 8 012345678901234567890123456789012345678901234567890123456789012345678901234567890 3.243F6A8885A308D313198A2E03707344A4093822299F31D0082EFA98EC4E6C89452821E638D01377B How long does it take to compute 13 digits of PI starting at digit D? D Seconds 1 2 0.00038478 2 4 0.000634621 3 8 0.00130325 4 16 0.00304501 5 32 0.00478882 6 64 0.00966862 7 128 0.0182844 8 256 0.0341298 9 512 0.0668518 10 1024 0.133606 11 2048 0.264833 12 4096 0.526185 13 8192 1.05822 14 16384 2.12708 15 32768 4.33159 16 65536 8.52364 17 131072 17.1386 18 262144 34.2197 19 524288 68.3917 20 1048576 137.221 CHUD_PI_TEST CHUD_PI computes the value of pi using the Chudnovsky approach. Request PI to 10, 20, 40, 80 digits. Request 10 digits: p = 3.141592654 Request 20 digits: p = 3.1415926535897932385 Request 40 digits: p = 3.141592653589793238462643383279502884197 Request 80 digits: p = 3.141592653589793238462643383279502884197169399375105820974944592307816406286209 How long does it take to compute PI to D digits? Digits Seconds 1 2 0.0309154 2 4 0.0280664 3 8 0.0276422 4 16 0.0544066 5 32 0.0747361 6 64 0.143185 7 128 0.261575 8 256 0.53375 9 512 1.13324 10 1024 2.59013 11 2048 7.17441 12 4096 21.9781 13 8192 73.0671 PI_TEST Normal end of execution. 28-Feb-2012 10:28:14 >>