SQLite cos() Function

The SQLite cos() function returns the cosine of the specified radian.

Syntax

Here is the syntax of the SQLite cos() function:

cos(number)

Parameters

number

Required. A number used to calculate the cosine, in radians.

Return value

The SQLite cos() function returns the cosine of the specified radian.

If the parameter number is NULL, the cos() function will return NULL.

Examples

This example shows the basic usage of the SQLite cos() function:

SELECT
    cos(2.5),
    cos(0.2),
    cos(-0.5),
    cos(-0.2),
    cos(0),
    cos(pi());
 cos(2.5) = -0.801143615546934
 cos(0.2) = 0.980066577841242
cos(-0.5) = 0.877582561890373
cos(-0.2) = 0.980066577841242
   cos(0) = 1.0
cos(pi()) = -1.0

Here, we use the pi() function to obtain an approximation of pi.