Math module

cos

procedure · 2 overloadsSource

The cosine of x in radians, as a float or float64. The result is in [-1, 1]; an infinite or NaN argument gives NaN.

ExampleOpen in playground ↗
assert(cos(0.0) == 1);
assert(abs(cos(PI) + 1) < 0.00001);
cos :: (x: float32) -> float32

Cosine.

Parameters

x: float32
the angle in radians.

Returns

float32
cos :: (x: float64) -> float64

Cosine.

Parameters

x: float64
the angle in radians.

Returns

float64

See also