10-28-2023, 04:36 PM
The formula in the wiki seems to be wrong. Is the result of the formula from the QBasic-Manual correct?
Code: (Select All)
Option _Explicit
Dim As Integer x
x = 0
Const PI = 1.141593
'Print _Arcsec(-2.5
Print
Print _Acos(1 / -2.5)
Print
Print ARCSECF(-2.5)
End
Function ARCSECF (x) ' Inverse Secant
Dim As Double Arcsec
If x <= 1 Or x >= 1 Then
Arcsec = Atn(Sqr(x * x - 1)) + Sgn(Sgn(x) - 1) * PI
Else Beep
End If
ARCSECF = Arcsec
End Function