Tämä salaperäinen 3.1415926...,
Tämän me kaikki muistamme, vähintään seitsemän ensimmäistä desimaalia...

 π  = 3.1415926535897932384626433832795028841971693993751...
The ratio of the circumference of a circle to its diameter.

Circle-pi

 pi=C/d=C/(2r)   1)

One of Archimedes many significant contributions to mathematics was his approximation of the value of π
He was the first mathematician to establish a theoretical calculation for π instead of an estimation.
By inscribing and circumscribing polygons on a circle, he was able to constrain the value of π between 3+10/71 and 3+1/7.

 
This mysterious π 3.141592..., which comes in at every door and window, and down every chimney.
Augustus De Morgan (1806-1871)

The following tiny C code computes digits of π   (Boris Gourevitch)
                    main(){
                        int a=10000,b,c=8400,d,e,f[8401],g;
                        for(;b-c;)f[b++]=a/5;
                        for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
                            for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
                    }
                    
1) Wolfram Mathworld

C-kielinen koodi π arvon laskemiseen


Testattu Ubuntu 18.04 Linux Kernel 4.15.0-72-generic
  Vaatii libgmp3-dev kirjaston
  Ubuntu: apt install libgmp3-dev



Powered By   Web Hosting by InMotion Hosting  and CodeIgniter 3.1.11