⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modmajorparsing.vb

📁 visual basic课程设计案例精编
💻 VB
📖 第 1 页 / 共 2 页
字号:
                Exit Function
                'Hyperbolic cosine
            Case "hcos"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = (System.Math.Exp(Value) + System.Math.Exp(-Value)) / 2
                End If

                'Hyperbolic cotangent
            Case "hcot"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = (System.Math.Exp(Value) + System.Math.Exp(-Value)) / (System.Math.Exp(Value) - System.Math.Exp(-Value))
                End If

                'Hyperbolic secant
            Case "hsec"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = 2 / (System.Math.Exp(Value) + System.Math.Exp(-Value))
                End If

                'Hyperbolic sine
            Case "hsin"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = (System.Math.Exp(Value) - System.Math.Exp(-Value)) / 2
                End If

                'Hyperbolic tangent
            Case "htan"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = (System.Math.Exp(Value) - System.Math.Exp(-Value)) / (System.Math.Exp(Value) + System.Math.Exp(-Value))
                End If

                'Inverse hyperbolic cosine
            Case "ihcos"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log(Value + System.Math.Sqrt(Value * Value - 1))
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse hyperbolic cosecant
            Case "ihcsc"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log((System.Math.Sign(Value) * System.Math.Sqrt(Value * Value + 1) + 1) / Value)
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse hyperbolic cotangent
            Case "ihcot"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log((Value + 1) / (Value - 1)) / 2
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse hyperbolic sine
            Case "ihsin"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log(Value + System.Math.Sqrt(Value * Value + 1))
                    ConvertToDegrees()
                    GetF = Value
                End If
                'Inverse hyperbolic secant
            Case "ihsec"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log((System.Math.Sqrt(-Value * Value + 1) + 1) / Value)
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse hyperbolic tangent
            Case "ihtan"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Log((1 + Value) / (1 - Value)) / 2
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse cosecant
            Case "icsc"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(Value / System.Math.Sqrt(Value * Value - 1)) + (System.Math.Sign(Value) - 1) * (2 * System.Math.Atan(1))
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse cosine
            Case "icos"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(-Value / System.Math.Sqrt(-Value * Value + 1)) + 2 * System.Math.Atan(1)
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse cotangent
            Case "icot"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(Value) + 2 * System.Math.Atan(1)
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse secant
            Case "isec"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(Value / System.Math.Sqrt(Value * Value - 1)) + System.Math.Sign((Value) - 1) * (2 * System.Math.Atan(1))
                    ConvertToDegrees()
                    GetF = Value
                End If

                'Inverse sine
            Case "isin"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(Value / System.Math.Sqrt(-Value * Value + 1))
                    ConvertToDegrees()
                    GetF = Value
                End If
                'Inverse tangent
            Case "itan"
                ExtractToken()
                Value = GetF()
                If InError Then
                    Exit Function
                Else
                    Value = System.Math.Atan(Value)
                    ConvertToDegrees()
                    GetF = Value
                End If
                'Secant
            Case "sec"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = 1 / System.Math.Cos(Value)
                End If

                'Sine
            Case "sin"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = System.Math.Sin(Value)
                End If

                'Tangent
            Case "tan"
                ExtractToken()
                Value = GetF()
                ConvertToRadians()
                If InError Then
                    Exit Function
                Else
                    GetF = System.Math.Tan(Value)
                End If

                'Equals sign
            Case "="

                'A string that starts with an equals sign is not
                'a reserved keyword
                If CurrentEntryIndex = 2 Then
                    TrapErrors(0)
                Else
                    TrapErrors(-10)
                End If

                'Check for stored variables or variables that
                'should be stored - anything else is an error
            Case Else
        End Select

        'Exit function before error handler
        Exit Function

ErrorHandler:

        'Trap errors
        TrapErrors(Err.Number)

    End Function
End Module

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -