哪个 2 的 168 次方计算是正确的,为什么?
Which calculation of 2 to the 168th power is correct, and why?
关于 this question from Quora,R 关闭了吗?
使用 Wofram Alpha:
374144419156711147060143317175368453031918731001856
在 Python 上:
374144419156711147060143317175368453031918731001856
而对于 R:
374144419156711147080244462828666486484022626226666
我相信如果您了解链接 post 中的数字计算机复杂性,那么解释是显而易见的。否则,我不明白为什么 reader 对这个非常具体的问题的摘要解释不能作为一个独立的 post 来回答。
对我有用...
> format(2^168,scientific = FALSE)
[1] "374144419156711147060143317175368453031918731001856"
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.12 (Sierra)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
我认为你的问题是使用 scipen。
scipen:
integer. A penalty to be applied when deciding to print numeric values in fixed or exponential notation. Positive values bias towards fixed and negative towards scientific notation: fixed notation will be preferred unless it is more than scipen digits wider.
关于 this question from Quora,R 关闭了吗?
使用 Wofram Alpha:
374144419156711147060143317175368453031918731001856
在 Python 上:
374144419156711147060143317175368453031918731001856
而对于 R:
374144419156711147080244462828666486484022626226666
我相信如果您了解链接 post 中的数字计算机复杂性,那么解释是显而易见的。否则,我不明白为什么 reader 对这个非常具体的问题的摘要解释不能作为一个独立的 post 来回答。
对我有用...
> format(2^168,scientific = FALSE)
[1] "374144419156711147060143317175368453031918731001856"
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.12 (Sierra)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
我认为你的问题是使用 scipen。
scipen: integer. A penalty to be applied when deciding to print numeric values in fixed or exponential notation. Positive values bias towards fixed and negative towards scientific notation: fixed notation will be preferred unless it is more than scipen digits wider.