TANH(3Cg)

NAME
tanh - returns hyperbolic tangent of scalars and vectors.

SYNOPSIS
  float  tanh(float a);
  float1 tanh(float1 a);
  float2 tanh(float2 a);
  float3 tanh(float3 a);
  float4 tanh(float4 a);

  half   tanh(half a);
  half1  tanh(half1 a);
  half2  tanh(half2 a);
  half3  tanh(half3 a);
  half4  tanh(half4 a);

  fixed  tanh(fixed a);
  fixed1 tanh(fixed1 a);
  fixed2 tanh(fixed2 a);
  fixed3 tanh(fixed3 a);
  fixed4 tanh(fixed4 a);

PARAMETERS

a   Vector or scalar of which to determine the hyperbolic tangent.

DESCRIPTION
Returns the hyperbolic tangent of a.

For vectors, the returned vector contains the hyperbolic tangent of each element of the input vector.

REFERENCE IMPLEMENTATION
tanh for a scalar float could be implemented like this.

  float tanh(float x)
  {
    float exp2x = exp(2*x);
    return (exp2x - 1) / (exp2x + 1);
  }

PROFILE SUPPORT
tanh is supported in all profiles except fp20.

SEE ALSO
atan, atan2, cosh, exp, sinh, tan