Feedback

PI nach der Bailey-Borwein-Plouffe-Formel berechnen

Sprache: VB

PI nach der Bailey-Borwein-Plouffe-Formel berechnen
''' <summary>
''' PI nach der Bailey-Borwein-Plouffe-Formel berechnen
''' </summary>
Public Function GetPI() As Double
    Dim PI As Double = 0
    For i As Integer = 0 To 100
        PI += 1 / Math.Pow(16, i) * (4 / ((8 * i) + 1) - 2 / ((8 * i) + 4) - 1 / ((8 * i) + 5) - 1 / ((8 * i) + 6))
    Next
    Return PI
End Function
''' <summary>
''' PI nach der Bailey-Borwein-Plouffe-Formel berechnen
''' </summary>
Public Function GetPI() As Double
    Dim PI As Double = 0
    For i As Integer = 0 To 100
        PI += 1 / Math.Pow(16, i) * (4 / ((8 * i) + 1) - 2 / ((8 * i) + 4) - 1 / ((8 * i) + 5) - 1 / ((8 * i) + 6))
    Next
    Return PI
End Function