Hello Guest it is April 25, 2024, 03:28:25 PM

Author Topic: No acos/asin?  (Read 3987 times)

0 Members and 1 Guest are viewing this topic.

Offline flick

*
  •  15 15
    • View Profile
No acos/asin?
« 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!

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: No acos/asin?
« Reply #1 on: July 11, 2009, 09:42:46 PM »
Google "VB asin" and you see how to code them yourself. Apparently they are not included in VB.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline flick

*
  •  15 15
    • View Profile
Re: No acos/asin?
« Reply #2 on: July 12, 2009, 03:21:47 AM »
Thanks.  Those are a lot cleaner than the guess & test versions I came up with. ;)
Re: No acos/asin?
« Reply #3 on: May 22, 2011, 06:18:35 PM »
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