R中大数的精确性
R能准确地表示多少位数?根据答案和答案,我希望R比我下面的小示例做得好得多(其中精度在16位数后下降):R中大数的精确性,r,R,R能准确地表示多少位数?根据答案和答案,我希望R比我下面的小示例做得好得多(其中精度在16位数后下降): log(.Machine$double.xmax,10) # 308.2547 (我在1:30){ a我建议您阅读G部分,浮点只有16位有效数字。请参阅的“更多想法”部分,并查看类似或需要更高精度的软件包。 log(.Machine$double.xmax, 10) # 308.2547 for (i in 1:30) { a <- rep(1, i) # make a ve
log(.Machine$double.xmax,10)
# 308.2547
(我在1:30){
a我建议您阅读G部分,浮点只有16位有效数字。请参阅的“更多想法”部分,并查看类似或需要更高精度的软件包。
log(.Machine$double.xmax, 10)
# 308.2547
for (i in 1:30) {
a <- rep(1, i) # make a vector of 1s
b <- paste(a, collapse = '') # turn into string
d <- as.double(b) # turn into double
e <- format(d, scientific = FALSE) # turn into string
print(e)
}
# "1"
# "11"
# "111"
# "1111"
# "11111"
# "111111"
# "1111111"
# "11111111"
# "111111111"
# "1111111111"
# "11111111111"
# "111111111111"
# "1111111111111"
# "11111111111111"
# "111111111111111"
# "1111111111111111"
# "11111111111111112"
# "111111111111111104"
# "1111111111111111168"
# "11111111111111110656"
# "111111111111111114752"
# "1111111111111111081984"
# "11111111111111111344128"
# "111111111111111109246976"
# "1111111111111111092469760"
# "11111111111111110924697600"
# "111111111111111104952008704"
# "1111111111111111049520087040"
# "11111111111111111869590405120"
# "111111111111111105501764517888"