User:Plutonium244/Code
From Apache OpenOffice Wiki
Diverse Funktionen für Calc.
' secans Function SEC(Value#) On Error Goto SecError SEC = 1.0 / Cos (Value#) Exit Function SecError: SEC = "DivByZero" End Function ' cosecans Function CSC (Value#) On Error Goto CscError CSC = 1.0 / Sin (Value#) Exit Function CscError: CSC = "DivByZero" End Function ' arcus secans Function ARCSEC(Value#) On Error Goto ArcsecError ARCSEC = Arccos (1.0 / Value#) Exit Function ArcsecError: ARCSEC = "Err:503" End Function ' arcus cosecans Function ARCCSC(Value#) On Error Goto ArccscError ARCCSC = Arcsin (1.0 / Value#) Exit Function ArccscError: ARCCSC = "Err:503" End Function 'square root Function SQRT(Value#) On Error Goto SQRTError SQRT = Sqr (Value#) Exit Function SQRTError: SQRT = "Err:503" End Function ' cubic root (the real, non-complex solution) Function CUR(Value#) On Error Goto CURError If Value# > 0.0 Then CUR = Exp (Log(Value#)/3) ElseIf Wert# < 0.0 Then CUR = - Exp (Log( - Value#)/3) Else CUR = 0.0 End If Exit Function CURError: CUR = "Err:503" End Function ' Root with annother exponent Function RADIX(Value#,Exponent%) On Error Goto RADIXError If Value# > 0.0 Then RADIX = Exp (Log(Value#)/Exponent%) ElseIf Wert# = 0.0 Then RADIX = 0.0 Else If Exponent% mod 2 = 1 Then RADIX = - Exp (Log( - Value#)/Exponent%) Else RADIX = "Err:503" End If End If Exit Function RADIXError: RADIX = "Err:503" End Function ' law of Pythagoras: c = sqr(a*a+b*b) Function HYPOT(A# , B#) On Error Goto HYPOTError HYPOT = Sqr(A# * A# + B# * B#) Exit Function HYPOTError: HYPOT = "Err:503" End Function ' Sinus from an angle given in degrees Function DEGSIN(value#) On Error Goto DEGSINError DEGSIN = Sin (value# * Pi()/180) Exit Function DEGSINError: DEGSIN = "Err:503" End Function ' Cosinus from an angle given in degrees Function DEGCOS(value#) On Error Goto DEGCOSError DEGCOS = Cos (value# * Pi()/180) Exit Function DEGCOSError: DEGCOS = "Err:503" End Function