Cos Function

与えられた角度の Cos (コサイン、余弦) 値を計算します。角度の単位はラジアンです。この関数の戻り値は、-1 から 1 の範囲を取ります。

Using the angle Alpha, the Cos function calculates the ratio of the length of the side that is adjacent to the angle, divided by the length of the hypotenuse in a right-angled triangle.

Cos(Alpha) = Adjacent/Hypotenuse

Syntax:


Cos (Number As Double) As Double

Return value:

Double

Parameters:

Number: Cos 値を計算させる角度を示す数値表式 (単位はラジアン)。

通常の角度をラジアン値に変換するには、角度×π/180 と計算します。ラジアン値を通常の角度に変換するには、ラジアン値×180/π と計算します。

通常の角度の値 = (ラジアン値*180)/pi

ラジアン値 = (通常の角度の値*pi)/180

Pi is here the fixed circle constant with the rounded value 3.14159...

Error codes:

5 無効なプロシージャー呼び出しです

Example:


REM この例では、直角三角形の一辺の長さとその頂角 (通常の角度) を
REM ユーザーに入力させて、斜辺の長さを計算しています。
Sub ExampleCosinus
REM Pi = 3.14159 と近似
Dim d1 As Double, dAngle As Double
    d1 = InputBox("Enter the length of the adjacent side: ","Adjacent")
    dAngle = InputBox("Enter the angle Alpha (in degrees):","Alpha")
    Print "The length of the hypotenuse is"; (d1 / cos (dAngle * Pi / 180))
End Sub

ご支援をお願いします!