Hello.
I'm having a problem with my for loop. Below is the code. a, b, c, and d are variables of type Double which have been calculated earlier. I want to find the maximum value of q12. For a particular set of values for a, b, c, and d, the answer is supposed to be maximum at pos_max=0.05. However, the answer produced is at pos_max=0.0499. Why is this so? Any help would be much appreciated.

Code:
    Dim i, max, pos_max As Double
    
    max=0
    For i = 0 To 0.05 Step 0.0001
        q12 = Abs(a * (i ^ 2) + b * i + c * (i ^ 2) + d * i)
        
        If (max < q12) Then
            max = q12
            pos_max = i   'max position on 1-2
        End If
    Next