COS(x) 函数用来计算 x 的余弦值,x 为弧度值。
(1)使用 COS 函数计算 1 余弦值,如下:
mysql> select COS(1); +--------------------+ | COS(1) | +--------------------+ | 0.5403023058681398 | +--------------------+ 1 row in set (0.02 sec)
(2)使用 COS 函数计算 0 余弦值,如下:
mysql> select COS(0); +--------+ | COS(0) | +--------+ | 1 | +--------+ 1 row in set (0.02 sec)
(3)使用 COS 函数计算 3.141593(PI())余弦值,如下:
mysql> select PI(); +----------+ | PI() | +----------+ | 3.141593 | +----------+ 1 row in set (0.03 sec) mysql> select COS(PI()); +-----------+ | COS(PI()) | +-----------+ | -1 | +-----------+ 1 row in set (0.03 sec)