R从字符转换时丢失浮点数精度

R从字符转换时丢失浮点数精度,r,casting,numeric,R,Casting,Numeric,我有一个大的浮点数,就像这样 x<-"5374761693.91823"; 我得到以下输出 5374761694 我希望在强制转换时保留数字的浮点性质。使用打印中的数字参数查看实际数字: > print(as.numeric(x), digits=15) [1] 5374761693.91823 选项是另一种选择: > options(digits=16) > as.numeric(x) [1] 5374761693.91823 > # assig

我有一个大的浮点数,就像这样

  x<-"5374761693.91823";
我得到以下输出

   5374761694

我希望在强制转换时保留数字的浮点性质。

使用
打印中的
数字
参数查看实际数字:

> print(as.numeric(x), digits=15)
[1] 5374761693.91823
选项
是另一种选择:

> options(digits=16)
> as.numeric(x)
[1] 5374761693.91823

> # assignments
> options(digits=16)
> y <- as.numeric(x)
> y
[1] 5374761693.91823

z <- print(as.numeric(x), digits=15)
z
>选项(数字=16)
>as.数字(x)
[1] 5374761693.91823
>#作业
>选项(数字=16)
>y y
[1] 5374761693.91823

作业呢?
> options(digits=16)
> as.numeric(x)
[1] 5374761693.91823

> # assignments
> options(digits=16)
> y <- as.numeric(x)
> y
[1] 5374761693.91823

z <- print(as.numeric(x), digits=15)
z