title: as.integer() on an int64 dataframe produces unexpected result
body: <p>I was reviewing some code and came across this odd result.  If you have a dataframe with one value of type integer and you coerce it to integer you get what I think you would expect:</p>
  <pre><code>library(dplyr)
  
  tibble(x = as.integer(c(1))) %&gt;% as.integer()
  
  [1] 1
  </code></pre>
  <p>But if it's of type int64, you get something weird:</p>
  <pre><code>library(bit64)
  
  tibble(x = as.integer64(c(1))) %&gt;% as.integer()
  
  [1] 0
  </code></pre>
  <p>What gives?  I assume it has something to do with the <code>int64</code> class.  But why would I get zero?  Is this just bad error handling?</p>
  <h2>Update</h2>
  <p>OK, there's a hint to what's going on when you call <code>dput</code> on the <code>int64</code> dataframe:</p>
  <pre><code>structure(list(x = structure(4.94065645841247e-324, 
                               class = &quot;integer64&quot;)), 
            row.names = c(NA, -1L), 
            class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
  </code></pre>
  <p>So <code>as.integer()</code> is rightly converting 4.94065645841247e-324 to zero.  But why is that what's stored in the DF?</p>
  <p>Also, to see that this is not a <code>bit64</code> issue, I get a very similar structure on the actual df I get back from my database:</p>
  <pre><code>structure(list(max = structure(2.78554211125295e-320,
                                 class = &quot;integer64&quot;)),
            class = &quot;data.frame&quot;, 
            row.names = c(NA, -1L))
  </code></pre>