亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? piclassic.c

?? 一個(gè)簡單的求圓周率的高精度源代碼
?? C
字號(hào):
/*
** Pascal Sebah : September 1999
** 
** Subject:
**
**    A very easy program to compute Pi with many digits.
**    No optimisations, no tricks, just a basic program to learn how
**    to compute in multiprecision.  
**
** Formulae:
**
**    Pi/4 =    arctan(1/2)+arctan(1/3)                     (Hutton 1)
**    Pi/4 =  2*arctan(1/3)+arctan(1/7)                     (Hutton 2)
**    Pi/4 =  4*arctan(1/5)-arctan(1/239)                   (Machin)
**    Pi/4 = 12*arctan(1/18)+8*arctan(1/57)-5*arctan(1/239) (Gauss)
**
**      with arctan(x) =  x - x^3/3 + x^5/5 - ...
**
**    The Lehmer's measure is the sum of the inverse of the decimal
**    logarithm of the pk in the arctan(1/pk). The more the measure
**    is small, the more the formula is efficient.
**    For example, with Machin's formula:
**
**      E = 1/log10(5)+1/log10(239) = 1.852
** 
** Data:
**
**    A big real (or multiprecision real) is defined in base B as:
**      X = x(0) + x(1)/B^1 + ... + x(n-1)/B^(n-1)
**      where 0<=x(i)<B
**
** Results: (PentiumII, 450Mhz)
**    
**   Formula      :    Hutton 1  Hutton 2   Machin   Gauss
**   Lehmer's measure:   5.418     3.280      1.852    1.786
**
**  1000   decimals:     0.2s      0.1s       0.06s    0.06s
**  10000  decimals:    19.0s     11.4s       6.7s     6.4s
**  100000 decimals:  1891.0s   1144.0s     785.0s   622.0s
**
** With a little work it's possible to reduce those computation
** times by a factor 3 and more:
**  
**     => Work with double instead of long and the base B can
**        be choosen as 10^8
**     => During the iterations the numbers you add are smaller
**        and smaller, take this in account in the +, *, /
**     => In the division of y=x/d, you may precompute 1/d and
**        avoid multiplications in the loop (only with doubles)
**     => MaxDiv may be increased to more than 3000 with doubles
**     => ...
*/
#include <time.h>
#include <stdio.h>
#include <malloc.h>
#include <math.h>
long B=10000; /* Working base */
long LB=4;    /* Log10(base)  */
long MaxDiv=450;  /* about sqrt(2^31/B) */
/*
** Set the big real x to the small integer Integer 
*/
void SetToInteger (long n, long *x, long Integer) {
  long i;
  for (i=1; i<n; i++) x[i] = 0;
  x[0] = Integer;
}
/*
** Is the big real x equal to zero ?
*/
long IsZero (long n, long *x) {
  long i;
  for (i=0; i<n; i++)  
    if (x[i])	return 0;
	return 1;
}
/*
** Addition of big reals : x += y
**  Like school addition with carry management
*/
void Add (long n, long *x, long *y) {
  long carry=0, i;
  for (i=n-1; i>=0; i--) {
    x[i] += y[i]+carry;
    if (x[i]<B) carry = 0;
    else {
      carry = 1;
      x[i] -= B;
    }
  }  
}
/*
** Substraction of big reals : x -= y
**  Like school substraction with carry management
**  x must be greater than y
*/
void Sub (long n, long *x, long *y) {
  long i;
  for (i=n-1; i>=0; i--) {
    x[i] -= y[i];
		if (x[i]<0) {
		  if (i) {	
        x[i] += B;
        x[i-1]--;
      }
		}
  }  
}
/*
** Multiplication of the big real x by the integer q 
** x = x*q.
**  Like school multiplication with carry management
*/
void Mul (long n, long *x, long q) {
  long carry=0, xi, i;
  for (i=n-1; i>=0; i--) {
    xi  = x[i]*q;		
    xi += carry;		
    if (xi>=B) {
      carry = xi/B;
      xi -= (carry*B);
    }
    else 
      carry = 0;
    x[i] = xi;
	}  
}
/*
** Division of the big real x by the integer d 
** The result is y=x/d.
**  Like school division with carry management
**  d is limited to MaxDiv*MaxDiv.
*/
void Div (long n, long *x, long d, long *y) {
  long carry=0, xi, q, i;
  for (i=0; i<n; i++) {
    xi    = x[i]+carry*B;
    q     = xi/d;
    carry = xi-q*d;   
    y[i]  = q;        
  }  
}
/*
** Find the arc cotangent of the integer p = arctan (1/p)
**  Result in the big real x (size n)
**  buf1 and buf2 are two buffers of size n
*/
void arccot (long p, long n, long *x, long *buf1, long *buf2) {
  long p2=p*p, k=3, sign=0;
  long *uk=buf1, *vk=buf2;
  SetToInteger (n, x, 0);
  SetToInteger (n, uk, 1);	/* uk = 1/p */
  Div (n, uk, p, uk);
  Add (n, x, uk);	          /* x  = uk */

  while (!IsZero(n, uk)) {
    if (p<MaxDiv)
      Div (n, uk, p2, uk);  /* One step for small p */
    else {
      Div (n, uk, p, uk);   /* Two steps for large p (see division) */
      Div (n, uk, p, uk);  
    }
    /* uk = u(k-1)/(p^2) */
    Div (n, uk, k, vk);       /* vk = uk/k  */
    if (sign) Add (n, x, vk); /* x = x+vk   */
    else Sub (n, x, vk);      /* x = x-vk   */
    k+=2;
    sign = 1-sign;
  }
}
/*
** Print the big real x
*/
void Print (long n, long *x) {
  long i; 
  printf ("%d.", x[0]);
  for (i=1; i<n; i++) {
    printf ("%.4d", x[i]);
    if (i%25==0) printf ("%8d\n", i*4);
  }
  printf ("\n");
}
/*
** Computation of the constant Pi with arctan relations
*/
void main () {  
  clock_t endclock, startclock; 
  long NbDigits=10000, NbArctan;
  long p[10], m[10];
  long size=1+NbDigits/LB, i;
  long *Pi      = (long *)malloc(size*sizeof(long));
  long *arctan  = (long *)malloc(size*sizeof(long));
  long *buffer1 = (long *)malloc(size*sizeof(long));
  long *buffer2 = (long *)malloc(size*sizeof(long)); 
  startclock = clock();    
  /*
  ** Formula used: 
  **   
  **   Pi/4 = 12*arctan(1/18)+8*arctan(1/57)-5*arctan(1/239) (Gauss)
  */
  NbArctan = 3;
  m[0] = 12; m[1] = 8;  m[2] = -5;
  p[0] = 18; p[1] = 57; p[2] = 239; 
  SetToInteger (size, Pi, 0);
  /*
  ** Computation of Pi/4 = Sum(i) [m[i]*arctan(1/p[i])] 
  */
  for (i=0; i<NbArctan; i++) {
    arccot (p[i], size, arctan, buffer1, buffer2);
    Mul (size, arctan, abs(m[i]));
    if (m[i]>0) Add (size, Pi, arctan);  
    else        Sub (size, Pi, arctan);  
  }
  Mul (size, Pi, 4);
  endclock = clock ();
  Print (size, Pi);  /* Print out of Pi */
  printf ("Computation time is : %9.2f seconds\n",  
         (float)(endclock-startclock)/(float)CLOCKS_PER_SEC ); 
  free (Pi);
  free (arctan);
 	free (buffer1);
 	free (buffer2);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区国产| 欧美激情资源网| 成人av电影在线观看| 国内欧美视频一区二区| 日本美女一区二区三区| 青青草成人在线观看| 偷窥少妇高潮呻吟av久久免费| 亚洲在线视频一区| 日韩经典一区二区| 麻豆精品视频在线观看免费| 极品销魂美女一区二区三区| 狠狠久久亚洲欧美| 成人看片黄a免费看在线| 不卡av免费在线观看| 色婷婷综合久久久久中文一区二区 | 国产精品久久久久久妇女6080| 日本一区二区免费在线观看视频| 亚洲国产精品二十页| 中文字幕视频一区二区三区久| 18欧美乱大交hd1984| 亚洲欧美电影一区二区| 污片在线观看一区二区| 青娱乐精品在线视频| 国产精品亚洲一区二区三区在线| 国产成人激情av| 91福利国产成人精品照片| 欧美高清性hdvideosex| 久久久精品黄色| 亚洲人成精品久久久久久| 一区二区三区高清不卡| 久久aⅴ国产欧美74aaa| 成+人+亚洲+综合天堂| 欧美日韩日日骚| 26uuu精品一区二区在线观看| 欧美国产精品中文字幕| 亚洲国产成人av| 精品在线亚洲视频| 91麻豆成人久久精品二区三区| 日韩一区二区三区免费看| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 午夜成人免费视频| 国产精品影视天天线| 欧美午夜影院一区| 国产视频一区不卡| 偷拍与自拍一区| 欧美国产一区二区在线观看| 狠狠色综合播放一区二区| va亚洲va日韩不卡在线观看| 欧美伦理影视网| 国产精品美女久久福利网站| 丝袜美腿一区二区三区| 不卡视频免费播放| 欧美一区二区美女| 亚洲免费在线电影| 国产精品888| 日韩一区二区在线看| 亚洲免费观看视频| 成人综合激情网| 欧美一级片在线看| 亚洲夂夂婷婷色拍ww47| 成人美女在线视频| 久久欧美一区二区| 日韩国产欧美三级| 欧美性欧美巨大黑白大战| 欧美激情一区二区三区全黄| 欧美aⅴ一区二区三区视频| 91片黄在线观看| 国产精品毛片大码女人| 国内偷窥港台综合视频在线播放| 91精品国产入口| 日韩vs国产vs欧美| 欧美久久久久久久久| 亚洲综合免费观看高清完整版 | 丰满亚洲少妇av| 国产午夜精品一区二区三区四区| 日本特黄久久久高潮| 欧美日韩国产成人在线91| 亚洲欧美激情视频在线观看一区二区三区 | www.日韩在线| 综合亚洲深深色噜噜狠狠网站| 国产91露脸合集magnet| 亚洲国产精品高清| 成人av影院在线| 国产精品久久久久久久久动漫| 懂色一区二区三区免费观看| 国产日韩欧美一区二区三区乱码| 国产精品88av| 亚洲欧美另类小说视频| 色天使色偷偷av一区二区| 亚洲在线观看免费| 日韩一区二区三区精品视频| 美国毛片一区二区| 国产午夜精品美女毛片视频| 成人黄色电影在线| 亚洲精品一二三四区| 欧美日本精品一区二区三区| 日韩av中文在线观看| 精品国产三级电影在线观看| 国产精品资源在线| 一区二区三区成人在线视频| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲女与黑人做爰| 欧美伦理影视网| 国产久卡久卡久卡久卡视频精品| 国产精品女上位| 欧美日韩国产在线播放网站| 免费久久精品视频| 国产精品久久久爽爽爽麻豆色哟哟| 91麻豆国产福利精品| 日本欧美一区二区| 中文字幕第一区第二区| 色综合色综合色综合| 蜜桃av一区二区| 亚洲六月丁香色婷婷综合久久| 欧美一区二区三区在线视频| 粉嫩欧美一区二区三区高清影视| 一区二区三区日韩欧美精品| 欧美va亚洲va| 欧美特级限制片免费在线观看| 激情久久五月天| 亚洲国产精品欧美一二99| 久久精品免视看| 91精品国产丝袜白色高跟鞋| 91麻豆国产在线观看| 国产一区二区精品久久99| 亚洲第一福利视频在线| 国产午夜精品一区二区三区嫩草| 欧日韩精品视频| 成人性色生活片免费看爆迷你毛片| 亚洲激情图片qvod| 国产日韩综合av| 日韩欧美美女一区二区三区| 欧美在线看片a免费观看| 成人一级片网址| 国产原创一区二区| 日韩1区2区3区| 一区二区三区成人| 国产精品第一页第二页第三页| 欧美成人一区二区三区| 欧美日韩成人一区二区| 91免费观看在线| 99久久精品国产麻豆演员表| 国产高清精品久久久久| 久久99精品久久久久久| 日本亚洲一区二区| 亚洲成人在线网站| 艳妇臀荡乳欲伦亚洲一区| 国产精品不卡一区| 中文一区一区三区高中清不卡| 精品理论电影在线观看| 日韩欧美一区二区三区在线| 制服丝袜日韩国产| 精品视频免费在线| 91福利精品第一导航| 在线免费观看日韩欧美| 在线观看成人小视频| 色就色 综合激情| 欧美视频在线一区| 欧美精品高清视频| 日韩一级二级三级| 日韩女优电影在线观看| 日韩精品最新网址| 精品国产123| 国产日韩欧美一区二区三区综合| 日本一区二区电影| 亚洲免费观看高清完整| 一区二区三区鲁丝不卡| 五月婷婷综合在线| 久久av中文字幕片| 懂色av中文字幕一区二区三区| 不卡的看片网站| 欧美私人免费视频| 日韩一区二区视频| 国产丝袜欧美中文另类| 中文字幕佐山爱一区二区免费| 有码一区二区三区| 日韩精品成人一区二区在线| 激情文学综合丁香| 91在线porny国产在线看| 在线视频综合导航| 日韩欧美卡一卡二| 国产精品视频观看| 亚洲成a人v欧美综合天堂下载 | 欧洲在线/亚洲| 91精品综合久久久久久| 久久久久亚洲蜜桃| 伊人开心综合网| 免费高清不卡av| youjizz久久| 欧美一区二区成人| 中文字幕在线不卡| 五月婷婷激情综合网| 福利电影一区二区| 欧美美女激情18p| 亚洲欧洲在线观看av| 免费成人在线视频观看| av亚洲精华国产精华精| 日韩欧美亚洲一区二区| 一区二区三区日韩在线观看| 精品一区二区精品|