COS

All functions > MATH > COS

Returns the cosine of an angle in radians.

Signatures

Returns: Cosine value (between -1 and 1)

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

Notes

  • Input angle must be in radians (use RADIANS() to convert from degrees)
  • Returns values in the range [-1, 1]
  • COS(0) = 1, COS(π/2) = 0, COS(π) = -1
  • Period of 2π: COS(x) = COS(x + 2π)
  • Even function: COS(-x) = COS(x)
  • Returns NULL if input is NULL

Examples

FeatureQL
SELECT
    f1 := COS(0e0),  -- Cosine of 0 radians is 1
    f2 := COS(3.141592653589793e0),  -- Cosine of π radians is -1
    f3 := COS(1.5707963267948966e0),  -- Cosine of π/2 radians is ~0
    f4 := COS(6.283185307179586e0),  -- Cosine of 2π radians is 1
    f5 := COS(-1.5707963267948966e0)  -- Even function: COS(-π/2) = COS(π/2)
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHAR
1.0-1.00.000000000000000061232339957367661.00.00000000000000006123233995736766

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19