commands → tanh

tanh(x)

The tanh command computes the hyperbolic tangent of x where x is in radians. If x is a floating point number then a floating point result is computed, otherwise the result represents an exact value.

Examples

# hardware floating point
tanh(1.0);
	0.761594155955765

# symbolic
tanh(1);
	tanh(1)

Algorithm

To compute tanh(x) in extended precision we compute its power series.

References

Gullberg, Jan. Mathematics: From the Birth of Numbers. Norton, 1996.