新人求教 二分法求根
为什么我一运行结果就是(1+4)/2=2.5 根本不循环????Private Sub Form_Load()
Dim l As Double, u As Double, m As Double
l = 1
u = 4
f = x ^ 3 + 4 * x ^ 2 - 10
m = (u + l) / 2
Do While (u - l) > 0.001
If fm * fl = 0 Then Exit Do
If fm * fl > 0 Then
l = m
Else
u = m
End If
Loop
MsgBox "x=" & m
End Sub