J
Jon Cosby
Someone see why this is? If GaussPrime returns true, the debugger doesn't
reach the next line in Factor. It goes directly the next line in the Click
event. If false, it goes to the next block until it finds a prime.
Private Function Factor(ByVal g As CNum) As CNum
...
If GaussPrime(g) Then
' No more factors
index += 1 ' Never reaches this breaking point
...
Private Function GaussPrime(ByVal g As CNum) As Boolean
Dim N As Integer = Norm(g) ' Norm: re*re + im*im
If PrimeNum(N) Then
GaussPrime = True
ElseIf g.Im = 0 Then
If PrimeNum(g.Re) And g.Re Mod 4 = 3 Then
GaussPrime = True
End If
Else
GaussPrime = False
End If
End Function
reach the next line in Factor. It goes directly the next line in the Click
event. If false, it goes to the next block until it finds a prime.
Private Function Factor(ByVal g As CNum) As CNum
...
If GaussPrime(g) Then
' No more factors
index += 1 ' Never reaches this breaking point
...
Private Function GaussPrime(ByVal g As CNum) As Boolean
Dim N As Integer = Norm(g) ' Norm: re*re + im*im
If PrimeNum(N) Then
GaussPrime = True
ElseIf g.Im = 0 Then
If PrimeNum(g.Re) And g.Re Mod 4 = 3 Then
GaussPrime = True
End If
Else
GaussPrime = False
End If
End Function