commands → tan

tan(x)

The tan command computes the 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 is an exact symbolic value.

Examples

# hardware floating point
tan(1.0);
	1.5574077246549

# symbolic
tan(1);
	tan(1)

Algorithm

To compute tan(x) in extended precision, x is first reduced modulo pi and then the power series of tan(x) is computed.

References

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