title: Fast hyperbolic tangent approximation in Javascript
body: <p>I'm doing some digital signal processing calculations in javascript, and I found that calculating the hyperbolic tangent (<strong>tanh</strong>) is a bit too expensive. This is how I currently approximate <strong>tanh</strong>:</p>
  
  <pre><code>function tanh (arg) {
      // sinh(number)/cosh(number)
      return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));
  }
  </code></pre>
  
  <p>Anyone knows a faster way to calculate it?</p>