Problems with calculating value
I have a problem...
I want clculate value of polynomial at some x (number). And if value of some polynomial is bigger than 0 then print x to text2.text if value is smaller than 0 then print x to text3.text.
Code:
Private Sub Command1_Click()
Dim x As Single
Dim p As Single
Dim a, b, c, d, e, f, g, h, i, j, k
a = Text1(0).Text
b = Text1(1).Text
c = Text1(2).Text
d = Text1(3).Text
e = Text1(4).Text
f = Text1(5).Text
g = Text1(6).Text
h = Text1(7).Text
i = Text1(8).Text
j = Text1(9).Text
k = Text1(10).Text
p = (k * x ^ 10 + j * x ^ 9 + i * x ^ 8 + h * x ^ 7 + g * x ^ 6 + f * x ^ 5 + e * x ^ 4 + d * x ^ 3 + c * x ^ 2 + b * x + a)
For x = -1 To 1 Step 0.1
If p < 0 Then
Text2.Text = x
End If
If p > 0 Then
Text3.Text = x
End If
Next x
End Sub
What is wrong?
Btw: Does currency mean that it calculate on 4 decimals?
Thank you