COS()

All functions > MATH > COS()

Returns the cosine of an angle in radians.

Signatures

Cosine

Returns: Cosine value in [-1, 1]

COS(radians: T) → DOUBLE
sql
ParameterTypeRequiredDescription
radiansTYesAngle in radians

With:

  • T : Floating-point type (FLOAT, DOUBLE)

Signature notes:

  • Input must be in radians; use RADIANS() to convert from degrees
  • Period of 2π; even function: COS(-x) = COS(x)
  • Returns NULL if the input is NULL

Examples

FeatureQL
SELECT
    -- cos(0) = 1
    f1 := COS(0e0),
    -- cos(π) = -1
    f2 := COS(3.141592653589793e0),
    -- cos(π/2) ≈ 0
    f3 := COS(1.5707963267948966e0),
    -- cos(2π) = 1
    f4 := COS(6.283185307179586e0)
;
Result
f1 DECIMALf2 DECIMALf3 DECIMALf4 DECIMAL
1.0-1.00.000000000000000061232339957367661.0