math.tan
Defined in module
"math"from "math" import tanReturns the tangent of x (in radians)
Parameters
x | number | angle in radians |
Return value
The tangent of x, always as a float.
Notes
Near an odd multiple of PI/2 the tangent has a vertical asymptote. Quirrel does not throw there; it returns whatever the underlying C tan computes for the (inexact) argument, typically a very large finite number rather than an error. That magnitude depends on the float precision the build uses and is not the same across platforms, so do not print or compare it.
Example
from "math" import tan, PI
println("tan(0) =", tan(0))
println("tan(PI/4) =", tan(PI/4))
println("tan(-PI/4) =", tan(-PI/4))Output:
tan(0) = 0
tan(PI/4) = 1
tan(-PI/4) = -1See also
sin | Returns the sine of x (in radians) |
cos | Returns the cosine of x (in radians) |
atan | Returns the arctangent of x |
PI | The ratio of a circle's circumference to its diameter, for converting between radians and degrees and for angle math in general. |
| math | module index |