https://github.com/wuhan005/calculate-pi
A small program which use the ActionScript3 to calculate the PI
https://github.com/wuhan005/calculate-pi
Last synced: 8 months ago
JSON representation
A small program which use the ActionScript3 to calculate the PI
- Host: GitHub
- URL: https://github.com/wuhan005/calculate-pi
- Owner: wuhan005
- License: mpl-2.0
- Created: 2016-09-25T04:54:12.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-11T10:17:24.000Z (over 8 years ago)
- Last Synced: 2024-12-29T13:46:25.503Z (10 months ago)
- Language: ActionScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Calculate-PI
A small program which use the ActionScript3 to calculate the PI使用数学中的几何概形来计算圆周率。
具体思路就是随机生成点,然后依据点的(x,y)坐标来计算与圆心的距离,来判断是否落在圆内。最初将times设置成与题目一样的1000次,得到结果为:3.188
并不是那么准确啊,接着不断把times增大,一直增大到播放器能承受的极限:99999999(虽然这不是CPU的极限,但是Flash播放器在计算超过15s后便会自动停止)最后得出的结果:3.1416809514168094,大概范围在3.1414-3.1416之间。