title: Hyperbolic Tangent in R throws NAN in Windows but not in Mac?
body: <p>When estimating the hyperbolic tangent in Windows using the R base function <code>tanh</code> for large (real, with 0 imaginary part) values the function returns 'NaN':</p>
  
  <pre><code>tanh(356 + 0i)
  &gt; NaN + 0i
  </code></pre>
  
  <p>However, in Mac the same value returns 1 (coinciding with the "real" mathematical value should be close to 1):</p>
  
  <pre><code>tanh(356 + 0i)
  &gt; 1 + 0i
  </code></pre>
  
  <blockquote>
    <p><strong>Question 1: Does anybody have a clue on why is this happening?</strong></p>
  </blockquote>
  
  <p><strong>Extra info</strong></p>
  
  <p>This seems not a floating point problem because it seems that Mac's <code>tanh</code> returns 1 for arbitrarily large values:</p>
  
  <pre><code>tanh(999999677873648767519238192348124812341234182374817239847812738481234871823+0i)
  &gt; 1 + 0i
  </code></pre>
  
  <p>The problem seems to be related with the imaginary part as:</p>
  
  <pre><code>tanh(356)
  &gt; 1
  </code></pre>
  
  <p>in both Windows and Mac. The issue seems to be system (or processor?)-specific as we have tried it in:</p>
  
  <ul>
  <li>Mac with El Capitan v 10.11.6 <strong>processor: 2.7 GHz Intel Core i5</strong></li>
  <li>Mac with Sierra v 10.12.3 <strong>processor: 3.2 GHz Intel Core i5</strong></li>
  <li>Windows 10 Home v 1607 <strong>processor: Intel Core m3-SY30 CPU@ 0.90 GHz 1.51 GHz</strong></li>
  <li>Windows 7 Home Premium Service Pack 1 <strong>processor: Intel Core i5-2410M CPU @2.30 GHz 2.30GHz.</strong></li>
  </ul>
  
  <p>These Windows machines throw <code>NaN</code>, the Mac's <code>1 + 0i</code>.
  In all cases we are using R version 3.3.3 the "newest" (64 bit). </p>