Cos函数

是返回指定角度的余弦的函数。

格式
Cos (数值)

参数

数值
以数值(弧度)指定角度。

返回值
用于返回已指定数值的余弦值(实值)。

说明
Cos用于返回已指定角度(弧度)的余弦。请用弧度指定要指定的角度(数值)。返回值的范围为-1~1。

以度赋予角度时,必须使用DegToRad函数变换为弧度。

参阅
Abs, Atan, Atan2, Int, Mod, Not, Sgn, Sin, Sqr, Str$, Tan, Val

Cos函数使用示例
下例为使用Cos的简单程序例。

Function costest
  Real x
  Print "Please enter a value in radians:"
  Input x
  Print "COS of ", x, " is ", Cos(x)
Fend

下例为从命令窗口使用Cos的示例。

Display the cosine of 0.55:

>print cos(0.55)
 0.852524522059506
>

Display cosine of 30 degrees:

>print cos(DegToRad(30))
 0.866025403784439
>