跳至正文
题库3832
#3832

1156. 求π的值

查看题目操作

1156. 求π的值

题目描述

根据公式:

arctanx(x)=x−x33+x55−x77+...arctanx(x) = x- \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + ...和π=6arctanx(13)π=6arctanx(\frac{1}{\sqrt{3}})

定义函数 arctanx(x)arctanx(x),逐项累加;遇到第一项绝对值小于 10−610^{-6} 时停止,该项不计入结果。计算所得近似 ππ 值。

输入格式

(无)

输出格式

ππ的值。保留到小数点后1010位。

(无)
3.1415905109

来源

一本通在线评测 ybtbas-1156