Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

COS function (ODBC compatible)

Syntax

COS ( expression )

Description

The scalar function COS returns the cosine of expression.

Example

select cos(45 * pi()/180) 'Cosine of 45 degrees' from syscalctable;

COSINE OF 45 DEG

----------------

0.707106781186548

1 record selected

Notes

COS takes an angle (expression) and returns the ratio of two sides of a right triangle. The ratio is the length of the side adjacent to the angle divided by the length of the hypotenuse.

  • Expression specifies an angle in radians
  • Expression must evaluate to an approximate numeric data type.

To convert degrees to radians, multiply degrees by Pi/180. To convert radians to degrees, multiply radians by 180/Pi.

TOCIndex