Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 编程/算法/API  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:求PI小数点后100万位的算法,感激不尽 [Re:nonnot]
xndd





发贴: 10
积分: 0
于 2005-11-27 23:17 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
搜了下,有个求800位的:

// 计算pi800位的程序

long b,c=2800,d,e,f[2801],g;
int main(int argc,char* argv[])
{
/*for(;b-c;)f[b++]=10000/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/10000),e=d%10000)
for(b=c;d+=f[b]*10000,f[b]=d%--g,d/=g--,--b;d*=b);*/
for(b=0;b<c;b++)
f[b] = 2;
e=0;
while(c > 0)
{
d=0;
for(b=c;b>0;b--)
{
d*=b;
d+=f[b]*10;
f[b]=d%(b*2-1);
d/=(b*2-1);
}
c-=1;
printf("%d",(e+d/10)%10);
e=d%10;
getch();
}
return 0;

/*

31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185

*/
}

是c呵呵


why edited on 2005-11-28 02:17


话题树型展开
人气 标题 作者 字数 发贴时间
9128 求PI小数点后100万位的算法,感激不尽 nonnot 14 2005-10-29 22:39
7689 Re:求PI小数点后100万位的算法,感激不尽 ranchgirl 75 2005-10-30 11:18
7596 Re:求PI小数点后100万位的算法,感激不尽 float 7 2005-11-20 11:47
7194 Re:求PI小数点后100万位的算法,感激不尽 xndd 7 2005-11-27 22:58
7906 Re:求PI小数点后100万位的算法,感激不尽 xndd 1291 2005-11-27 23:17

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923