Skip to content

Instantly share code, notes, and snippets.

@cache-tlb
Created January 20, 2020 07:11
Show Gist options
  • Save cache-tlb/e3a6e4ee77c6e4be57a9e21dfe45e5e8 to your computer and use it in GitHub Desktop.
Save cache-tlb/e3a6e4ee77c6e4be57a9e21dfe45e5e8 to your computer and use it in GitHub Desktop.

Revisions

  1. cache-tlb created this gist Jan 20, 2020.
    6 changes: 6 additions & 0 deletions print_pi.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    long a=10000,b,c=2800,d,e,f[2801],g;
    void main(){
    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);
    }