Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 380
Viewed: 2767
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

various routine for math functions

Highlight all by clicking in box
<!---Declaration--->
none

Highlight All
<!---Code--->
'Secant
Public Function Sec(ByVal Number As Double) As Double
Sec = 1 / Cos(Number)
End Function

'Cosecant
Public Function Csc(ByVal Number As Double) As Double
Csc = 1 / Sin(Number)
End Function

'Cotangent
Public Function Ctn(ByVal Number As Double) As Double
Ctn = 1 / Tan(Number)
End Function

'Inverse Sine
Public Function ASin(ByVal Number As Double) As Double
ASin = Atn(Number / Sqr(-Number * Number + 1))
End Function

'Inverse Cosine
Public Function ACos(ByVal Number As Double) As Double
ACos = Atn(-Number / Sqr(-Number * Number + 1)) + 2 * Atn(1)
End Function

'Inverse Secant
Public Function ASec(ByVal Number As Double) As Double
ASec = Atn(Number / Sqr(Number * Number - 1)) + Sgn((Number) - 1) * (2 *
Atn(1))
End Function

'Inverse Cosecant
Public Function ACsc(ByVal Number As Double) As Double
ACsc = Atn(Number / Sqr(Number * Number - 1)) + (Sgn(Number) - 1) * (2 *
Atn(1))
End Function

'Inverse Cotangent
Public Function ACtn(ByVal Number As Double) As Double
ACtn = Atn(Number) + 2 * Atn(1)
End Function

'Hyperbolic Sine
Public Function SinH(ByVal Number As Double) As Double
SinH = (Exp(Number) - Exp(-Number)) / 2
End Function

'Hyperbolic Cosine
Public Function CosH(ByVal Number As Double) As Double
CosH = (Exp(Number) + Exp(-Number)) / 2
End Function

'Hyperbolic Tangent
Public Function TanH(ByVal Number As Double) As Double
TanH = (Exp(Number) - Exp(-Number)) / (Exp(Number) + Exp(-Number))
End Function

'Hyperbolic Secant
Public Function SecH(ByVal Number As Double) As Double
SecH = 2 / (Exp(Number) + Exp(-Number))
End Function

'Hyperbolic Cosecant
Public Function CscH(ByVal Number As Double) As Double
CscH = 2 / (Exp(Number) - Exp(-Number))
End Function

'Hyperbolic Cotangent
Public Function CtnH(ByVal Number As Double) As Double
CtnH = (Exp(Number) + Exp(-Number)) / (Exp(Number) - Exp(-Number))
End Function

'Inverse Hyperbolic Sine
Public Function ASinH(ByVal Number As Double) As Double
ASinH = Log(Number + Sqr(Number * Number + 1))
End Function

'Inverse Hyperbolic Cosine
Public Function ACosH(ByVal Number As Double) As Double
ACosH = Log(Number + Sqr(Number * Number - 1))
End Function

'Inverse Hyperbolic Tangent
Public Function ATanH(ByVal Number As Double) As Double
ATanH = Log((1 + Number) / (1 - Number)) / 2
End Function

'Inverse Hyperbolic Secant
Public Function ASecH(ByVal Number As Double) As Double
ASecH = Log((Sqr(-Number * Number + 1) + 1) / Number)
End Function

'Inverse Hyperbolic Cosecant
Public Function ACscH(ByVal Number As Double) As Double
ACscH = Log((Sgn(Number) * Sqr(Number * Number + 1) + 1) / Number)
End Function

'Inverse Hyperbolic Cotangent
Public Function ACtnH(ByVal Number As Double) As Double
ACtnH = Log((Number + 1) / (Number - 1)) / 2
End Function

'Logarithm to base N
Public Function LogN(ByVal Base As Double, ByVal Number As Double)
LogN = Log(Number) / Log(Base)
End Function

'Convert degrees to radians
Public Function DegToRad(ByVal Number As Double) As Double
DegToRad = Number * 1.74532925199433E-02 'pi/180
End Function

'Convert radians to degrees
Public Function RadToDeg(ByVal Number As Double) As Double
RadToDeg = Number * 57.2957795130824 ' 180/pi
End Function
;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions