如果GNU bc适合你,这可能会:
http://phodd.net/gnu-bc/bcfaq.html#bccbrt
编辑:
它基本归结为:
$ bc -l
define cbrt(x) { return e(l(x)/3) }
Run Code Online (Sandbox Code Playgroud)
您需要增加scale变量才能获得必要的精度:
$ bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
define cbrt(x) { return e(l(x)/3) }
cbrt(10000000000000000000000000000000000000000000000000000000000000000000)^3
9999999999999999999845725361475980907263179272258247094885777761435.\
89049462743995306310
scale=1000
cbrt(10000000000000000000000000000000000000000000000000000000000000000000)^3
9999999999999999999999999999999999999999999999999999999999999999999.\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999978254573198390239858\
069738839057154871628814670160708326688382280410
Run Code Online (Sandbox Code Playgroud)
正如您可能已经注意到的那样,在不增加scale变量的情况下(在我的系统上它默认为20),结果远不及您所需的精度.
| 归档时间: |
|
| 查看次数: |
2352 次 |
| 最近记录: |