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
| Parameter | Type | Required | Description |
|---|---|---|---|
radians | T | Yes | Angle 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 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR | f5 VARCHAR |
|---|---|---|---|---|
| 1.0 | -1.0 | 0.00000000000000006123233995736766 | 1.0 | 0.00000000000000006123233995736766 |
On this page