COS
Returns the cosine of an angle given in radians.
PostgreSQL 17.9
COS(angle)- angle
- Angle in radiansdouble precision
Return value
A floating-point number (double precision) from -1 to 1
Examples
Cosine of a straight angle
PostgreSQL 17.9
SELECT COS(PI());Angle in radians and in degrees
PostgreSQL 17.9
SELECT COS(RADIANS(60)) AS from_radians,
COSD(60) AS from_degrees;Details
For an angle in degrees, use COSD.
COS(PI() / 2) gives about 6e-17, not exactly 0.