Axuda do LibreOffice 24.8
Determines the tangent of an angle. The angle is specified in radians.
Using the angle Alpha, the Tan function calculates the ratio of the length of the side opposite the angle to the length of the side adjacent to the angle in a right-angled triangle.
Tan(Alpha) = side opposite the angle/side adjacent to angle
Tan (Number As Double) As Double
Double
Number: Any numeric expression that you want to calculate the tangent for (in radians).
To convert degrees to radians, multiply by Pi/180. To convert radians to degrees, multiply by 180/Pi.
degrees=(radians*180)/Pi
radians=(degrees*Pi)/180
Pi is approximately 3.141593.
' Neste exemplo, a entrada seguinte é posíbel nun triángulo recto:
REM O ángulo (en graos) e o seu lado oposto para calcular a lonxitude do lado adxacente ao ángulo:
Sub ExampleTangens
REM Pi = 3,1415926 é unha variábel predefinida
Dim d1 As Double
Dim dAlpha As Double
d1 = InputBox("Introduza a lonxitude do lado oposto ao ángulo: ","opposite")
dAlpha = InputBox("Introduza o ángulo Alfa (en graos): ","Alpha")
Print "a lonxitude do lado adxacente ao ángulo é"; (d1 / tan (dAlpha * Pi / 180))
End Sub