tanh function

double tanh(
  1. double x
)

Hyperbolic Tangent - Utilises exponentials in order to shrink a range of numbers to strictly in-between -1 and 1, -1 and 1 being the mfunction's asymptotes, towards which the curve tends.

Implementation

double tanh(double x) => (exp(x) - exp(-x)) / (exp(x) + exp(-x));