Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: flick on July 11, 2009, 08:08:27 PM
-
There's an atn function, to calculate arctan's... but no inverse functions for the other two? Am I overlooking them somehow? I need them!
-
Google "VB asin" and you see how to code them yourself. Apparently they are not included in VB.
-
Thanks. Those are a lot cleaner than the guess & test versions I came up with. ;)
-
Function ArcSin(X As Double) As Double
ArcSin = Atn(X / Sqr(-X * X + 1))
End Function
Function ArcCos(X As Double) As Double
ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
Private Sub Command1_Click()
' replace the 0.5 below with the degree (in radians) that
' you want to calculate its ArcSin or ArcCos value
MsgBox "ArcSin(0.5) = " & ArcSin(0.5)
MsgBox "ArcCos(0.5) = " & ArcCos(0.5)
End Sub