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