当有一项的绝对值小于10e-6停止计算

def cul() :
ans = 0;add = 1
sign = 1
while(1/add>10**(-6)) :
ans = ans + sign/add
add = add + 2
sign = -sign
else :
ans += sign/add
print("pi = {}".format(ans * 4))
print("pi = %.8f"%(ans * 4)) cul()

  

最新文章

  1. SQL 2012 镜像 图解(解决1418)
  2. install zabbix-agent on CENTOS
  3. Spring Boot 配置优先级顺序
  4. docker的一些命令
  5. linux常用服务软件搭建及使用技巧
  6. hive中UDF、UDAF和UDTF使用
  7. Visual Studio 2015 NuGet Update-Package 失败/报错:Update-Package : Unable to load the service index for source https://api.nuget.org/v3/index.json.
  8. python做数据驱动
  9. java中String字符串的==解析
  10. Shader、Draw Call和渲染管线(Rendering Pipeline)
  11. ProcessExplorer使用分享
  12. Conjugate Function
  13. VC++ 获取系统时间、程序运行时间(精确到秒,毫秒)的五种方法
  14. linux查看目录下所有文件内容中是否包含某个字符串
  15. Jmeter常用脚本开发之Debug Sampler
  16. php Only variables can be passed by reference
  17. sql 智能提示
  18. vue 登录验证引擎
  19. IDEA里运行程序时出现Error:scalac:error while loading JUnit4 , Scala signature JUnit4 has wrong version错误的解决办法(图文详解)
  20. House of Roman 实战

热门文章

  1. Centos610安装redis
  2. 设计模式课程 设计模式精讲 12-2 适配器模式coding
  3. 题解 CF165D 【Beard Graph】
  4. 【转载】将Centos的yum源更换为国内的阿里云源
  5. 二、java基础-运算符_控制语句_break_continue_return
  6. JS动态获取 Url 参数
  7. 命令行添加删除tomcat服务
  8. 【Unity】鼠标点选物体
  9. Jquery属性操作、添加类
  10. ubuntu安装discourse论坛----结合在apache服务上建立虚拟主机