title: What is the rationale for as.logical double coercion?
body: <p>I'm trying to understand the coercion rationale for doubles:</p>
  
  <pre><code>as.logical(c(-1, -0.01, 0, 0.01, 0.1,1:10))
  #&gt;  [1]  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
  #&gt; [12]  TRUE  TRUE  TRUE  TRUE
  </code></pre>
  
  <p>I can see that coercion happens on a scalar (sign doesn't matter) and
  that only exactly 0 is coerced to <code>FALSE</code>. I was surprised by this,
  there seems to be no notion of "closest to..." or rounding to 0L or 1L.
  I'm curious as to why.</p>
  
  <p>I did try to hunt around for insight
  <a href="https://github.com/wch/r-source/search?utf8=%E2%9C%93&amp;q=as.logical" rel="nofollow noreferrer">here</a>
  but no success.</p>
  
  <p>I also looked at <a href="https://stackoverflow.com/questions/5681166/what-evaluates-to-true-false-in-r">this related question</a>.</p>
  
  <p>Can someone explain why I should expect each of the above tested values
  to coerce as they do?</p>