Cos Function

Calcula el cosinus d'un angle. L'angle s'especifica en radians. El resultat es troba entre -1 i 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

Sintaxi:


Cos (Number As Double) As Double

Valor de retorn:

Double

Paràmetres :

Nombre: Expressió numèrica que especifica un angle en radians per al qual voleu calcular el cosinus.

Per convertir graus en radians, multipliqueu els graus per pi/180. Per convertir radians en graus, multipliqueu els radians per 180/pi.

grau=(radian*180)/pi

radian=(grau*pi)/180

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

Codis d'error

5 La crida al procediment no és vàlida

Exemple :


' L'exemple següent permet en un triangle rectangle l'entrada de
' secant i angle (en graus) i calcula la longitud de la hipotenusa:
Sub ExampleCosinus
' Pi arrodonit = 3,14159
Dim d1 As Double, dAngle As Double
    d1 = InputBox("Introduïu la longitud del costat adjacent: ","Adjacent")
    dAngle = InputBox("Introduïu l'angle Alpha (en graus): ","Alpha")
    Print "The length of the hypotenuse is"; (d1 / cos (dAngle * Pi / 180))
End Sub

Ens cal la vostra ajuda!