Quirrel4.41.0

math.cos

Defined in module "math"
from "math" import cos
pure fastcall cos(x: number): float

Returns the cosine of x (in radians)

Parameters

xnumberangle in radians

Return value

The cosine of x, always as a float.

Notes

x is defined for any real number; there is no restricted domain to worry about, unlike asin and acos.

Example

examples/math/cos.nut
from "math" import cos, PI

println("cos(0) =", cos(0))
println("cos(PI/3) =", cos(PI/3))
println("cos(PI) =", cos(PI))
Output:
cos(0) = 1
cos(PI/3) = 0.5
cos(PI) = -1

See also

sinReturns the sine of x (in radians)
tanReturns the tangent of x (in radians)
acosReturns the arccosine of x
PIThe ratio of a circle's circumference to its diameter, for converting between radians and degrees and for angle math in general.
mathmodule index