免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2680 | 回复: 2
打印 上一主题 下一主题

[数值计算] bc -l pi=3.1 [复制链接]

论坛徽章:
6
程序设计版块每日发帖之星
日期:2016-05-11 06:20:00操作系统版块每日发帖之星
日期:2016-05-12 06:20:00每日论坛发贴之星
日期:2016-05-12 06:20:00操作系统版块每日发帖之星
日期:2016-05-14 06:20:00程序设计版块每日发帖之星
日期:2016-05-31 06:20:00每日论坛发贴之星
日期:2016-05-31 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2018-05-18 07:29 |只看该作者 |倒序浏览
本帖最后由 1cpuer 于 2018-05-18 17:27 编辑

bc -l
scale=8;a(1)*4
3.14159264
quit

a(1) 是设么?


论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
2 [报告]
发表于 2018-05-18 13:25 |只看该作者
# echo "scale=8; 4*a(1)" | bc -l
3.14159264

论坛徽章:
4
15-16赛季CBA联赛之青岛
日期:2018-07-09 14:17:2815-16赛季CBA联赛之八一
日期:2018-08-06 15:30:0515-16赛季CBA联赛之广东
日期:2018-08-09 09:11:2115-16赛季CBA联赛之佛山
日期:2019-02-14 09:26:31
3 [报告]
发表于 2018-05-18 19:29 |只看该作者
本帖最后由 christmas1102 于 2018-05-18 19:30 编辑

command line>>> man bc

MATH LIBRARY
       If bc is invoked with the -l option, a math library is preloaded and the default scale is set to 20.   The math functions will calculate  their  results  to  the
       scale set at the time of their call.  The math library defines the following functions:

       s (x)  The sine of x, x is in radians.
       c (x)  The cosine of x, x is in radians.
       a (x)  The arctangent of x, arctangent returns radians.
       l (x)    The natural logarithm of x.
       e (x)    The exponential function of raising e to the value x.
       j (n,x)    The Bessel function of integer order n of x.


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP