w3resource

PostgreSQL COS() function

COS() function

The PostgreSQL cos() function is used to return the cosine of a given argument in radians.

Uses of COS() Function
  • Trigonometric Calculations: Utilized in mathematical and engineering applications to calculate the cosine of angles.

  • Data Analysis: Applied in data processing where trigonometric transformations are required.

  • Graphical Applications: Used in generating and manipulating graphical data involving angles.

  • Scientific Research: Essential in fields such as physics and astronomy where precise trigonometric functions are needed.

Syntax:

cos(a)

PostgreSQL Version: 9.3

Pictorial presentation of PostgreSQL COS() function

pictorial presentation of PostgreSQL COS() function

Example PostgreSQL COS() function

Code:

SELECT COS(0) AS "Cos (0)";

Sample Output:

 Cos (0)
---------
       1
(1 row)

Example 2: PostgreSQL COS() function

Code:

SELECT COS(1) AS "Cos (1)";

Sample Output:

     Cos (1)
------------------
 0.54030230586814
(1 row)

Example 3: PostgreSQL COS() function

Code:

SELECT COS(-1) AS "Cos (-1)";

Sample Output:

     Cos (-1)
------------------
 0.54030230586814
(1 row)

Previous: CEILING function
Next: COT function



Follow us on Facebook and Twitter for latest update.