Skip to main content

cos

Function cos 

Source
pub fn cos(x: number) -> number
Expand description

Returns the cosine of a number given in radians.

§Parameters

  • x: an angle in radians.

§Return value

The cosine of x, as a float in the range [−1, 1].

§Examples

print(math.cos(0))          --> 1.0
print(math.cos(math.pi))    --> -1.0

§See also

sin, tan, acos, rad