Cos v0.1.0

Source
Returns the cosine of an angle in radians.

Package: Math

Signature

func Cos(x: float64) -> float64;
func Cos(x: float32) -> float32;

Parameters

NameTypeDescription
xfloat64 / float32An angle, in radians.

Returns

The cosine of x, in the range [-1, 1]. Cosine has no limit at infinity, so Cos(±Inf) is a NaN; a NaN argument also propagates.

Example

import Math::{ Cos, Pi };

func Main() -> int {
    let a = Cos(0.0); // 1.0
    let b = Cos(Pi);  // -1.0
    return 0;
}

See also

  • Math — the package overview
  • Sin — sine
  • Tan — tangent
  • ArcCos — the inverse of Cos
  • DegToRad — convert a degree value to radians first