SQLite cos() Function

Savigo
You organize your data. Now organize your savings.
Set savings goals, track your progress, and stay on course.
Get Savigo for iPhone 

In SQLite, the cos() function returns the cosine of a value specified in radians.

Syntax #

cos(x)

Arguments #

x

x is a number, an expression, or a table column that you want to calculate the cosine.

Return Type #

real

The function returns the cosine of x in radians. If x is NULL, the function returns NULL.

If x is a string, the cos() function will convert it into a number before calculating the cosine. If the conversion fails, the cos() function returns NULL.

Examples #

The following example uses the cos() function to calculate the cosine of zero (0):

SELECT cos(0) result;

Output:

result
------
1.0

The following statement uses the cos() function to return the cosine of pi:

SELECT cos(pi()) result;

Output:

result
------
-1.0

Was this tutorial helpful?