by Cuong C. To (2 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 9th August 2001
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Using Variant in VB 5.0 carefully
API Declarations
following codes to find that root. I don't get it in VB 5.0 but in VB 6.0 I can.
a = 0
b = 1
While (b - a) >= 0.00000001
x = (a + b) / 2
fx = x ^ 3 - 3 * x + 1
If fx > 0 Then a = x Else b = x
Wend
x = (a + b) / 2 ' x is the root