找回密码
 欢迎注册
楼主: plp626

[讨论] 一个计算圆周率任意精度的spigot算法研究

[复制链接]
 楼主| 发表于 2011-4-26 13:15:50 | 显示全部楼层
38# liangbch


不知到为什么,你的代码在我的gcc上运行提示找不到lib-gmp10.dll,

精简版vc6.0编译报错误:
--------------------Configuration: p - Win32 Debug--------------------
Compiling...
p.c
d:\documents_and_settings\plp2\desktop\p.c(11) : warning C4244: 'function' : conversion from '__int64 ' to 'double ', possible loss of data
d:\documents_and_settings\plp2\desktop\p.c(14) : error C2063: 'DWORD' : not a function
d:\documents_and_settings\plp2\desktop\p.c(15) : error C2063: 'DWORD' : not a function
d:\documents_and_settings\plp2\desktop\p.c(26) : error C2059: syntax error : 'type'
d:\documents_and_settings\plp2\desktop\p.c(29) : error C2275: 'INT64' : illegal use of this type as an expression
        d:\documents_and_settings\plp2\desktop\p.c(6) : see declaration of 'INT64'
d:\documents_and_settings\plp2\desktop\p.c(29) : error C2146: syntax error : missing ';' before identifier 't2'
d:\documents_and_settings\plp2\desktop\p.c(29) : error C2065: 't2' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(29) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
d:\documents_and_settings\plp2\desktop\p.c(32) : error C2065: 't1' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(32) : warning C4244: '/=' : conversion from '__int64 ' to 'int ', possible loss of data
d:\documents_and_settings\plp2\desktop\p.c(33) : warning C4244: '/=' : conversion from '__int64 ' to 'int ', possible loss of data
d:\documents_and_settings\plp2\desktop\p.c(39) : error C2059: syntax error : 'type'
d:\documents_and_settings\plp2\desktop\p.c(43) : error C2059: syntax error : 'else'
d:\documents_and_settings\plp2\desktop\p.c(47) : error C2065: 'low_p' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(47) : error C2065: 'high_p' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(47) : error C2099: initializer is not a constant
d:\documents_and_settings\plp2\desktop\p.c(48) : error C2065: 'low_q' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(48) : error C2065: 'high_q' : undeclared identifier
d:\documents_and_settings\plp2\desktop\p.c(48) : error C2099: initializer is not a constant
d:\documents_and_settings\plp2\desktop\p.c(49) : error C2059: syntax error : '}'
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2011-4-26 13:20:15 | 显示全部楼层
a,p作为分母超过40万(2^32/10000)了就可以舍弃了
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2011-4-26 13:24:01 | 显示全部楼层
这个问题要是能给出数学上的解法 该有多迷人啊。。。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2011-4-26 13:29:09 | 显示全部楼层
31# liangbch

sqrt(N)=(q/p)sqrt(1-1/a), 显然p,q是sqrt(N)的一个有理数逼近


这个思路确实不错。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-26 19:21:43 | 显示全部楼层
20# ▄︻┻═┳一‥

额,建议▄︻┻═┳一‥  童鞋 不要盗用我们老大的图像,。。。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-26 21:59:54 | 显示全部楼层
45# wayne

按 Ctrl+F5 强制刷新一下,头像才会是最新的。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-26 22:33:31 | 显示全部楼层
46# gxqcn
呵呵,原来我这的信息落后了啊
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-26 22:38:41 | 显示全部楼层
41# plp626
第一,liangbch 兄的代码似乎并没有用到GMP库
第二,把print_pq(3,1000000I64); 里面的I64去掉,用 g++编译
第三,VC6.0 跟IE6一样,早就该进坟墓了
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-26 22:55:09 | 显示全部楼层
48# wayne

  也许我比较保守吧。我一直用VC6.现在我的电脑中同时装有VC6和VC2008, 但VC6用的更多些。极少使用GCC编译自己的程序,尽管公司用的编译器主要是GCC。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 09:13:16 | 显示全部楼层
49# liangbch
过谦了,你这叫做专业,
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-5-1 00:27 , Processed in 0.051553 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表