[R] Strange sprintf Behavior
Michael Smith
my.r.help at gmail.com
Wed Apr 2 13:32:26 CEST 2014
All,
I'm getting this:
> sprintf("%.17f", 0.8)
[1] "0.80000000000000004"
Where does the `4` at the end come from? Shouldn't it be zero at the
end? Maybe I'm missing something.
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C
LC_TIME=en_US.utf8
[4] LC_COLLATE=en_US.utf8 LC_MONETARY=en_US.utf8
LC_MESSAGES=en_US.utf8
[7] LC_PAPER=en_US.utf8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.utf8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Thanks,
M
More information about the R-help
mailing list