title: R: Possible loss of precision when saving data frame to CSV?
body: <p>I stumbled into a strange behavior in R, where <code>double</code> values are not saved to a CSV as the original value.</p>
  
  <p>Reproducible example:</p>
  
  <pre><code>set.seed(1)
  df &lt;- data.frame(ID = 1:10, X = rnorm(10))
  write.csv(df, "test.csv", row.names = F)
  read.csv("test.csv") == df
          ID     X
   [1,] TRUE FALSE
   [2,] TRUE FALSE
   [3,] TRUE FALSE
   [4,] TRUE FALSE
   [5,] TRUE FALSE
   [6,] TRUE FALSE
   [7,] TRUE FALSE
   [8,] TRUE FALSE
   [9,] TRUE FALSE
  [10,] TRUE  TRUE
  </code></pre>
  
  <p>Granted, the difference appears to occur only at or after the 15th decimal digit, but it makes me uneasy to trust the CSV file.</p>
  
  <pre><code>options(digits = 20)
  
  df[1,]
    ID                    X
  1  1 -0.62645381074233242
  
  read.csv("test.csv")[1,]
    ID                    X
  1  1 -0.62645381074233197
  </code></pre>
  
  <p>Is there any way to circumvent this issue? Is it a known bug?</p>