COS

Returns the cosine of an angle in radians.

Signature

    ┌─────────┐
IN ─┤   COS   ├─ OUT
    └─────────┘
FUNCTION COS : ANY_REAL
  VAR_INPUT
    IN : ANY_REAL;
  END_VAR
END_FUNCTION

The return type matches the input type. COS accepts REAL, LREAL.

Inputs

Name

Type

Description

IN

ANY_REAL

Angle in radians.

Outputs

Name

Type

Description

Return value

ANY_REAL

The cosine of IN, in the range [-1.0, 1.0]. Same type as IN.

Description

Returns the cosine of IN, where IN is an angle expressed in radians. The result is in the range [-1.0, 1.0].

Example

result := COS(REAL#0.0);          (* result = 1.0 *)
value := COS(LREAL#3.1415927);   (* value ~ -1.0 *)

See Also

  • SIN — sine

  • TAN — tangent

  • ACOS — arc cosine

References