M
Merlin
Can someone please explain this as it has serious implications for me.
The following code if added together on a calculator adds to 100, but if you
run my example in a vb form with a standard textbox and check the value of D
at the stop statement the value does not equal 100, but 99.999999999999986.
If you resume the program the TextBox1.text will show as 100.
(Why all these number you say - I have a program that stores a large list of
values and performs complex calculations on them).
Dim d As Double
d = d + 63.528588
d = d + 30.013506
d = d + 0.100045
d = d + 1.850833
d = d + 3.001351
d = d + 0.005002
d = d + 0.300135
d = d + 1.20054
If d <> 100 Then MsgBox("wtf!")
Stop
TextBox1.Text = d.ToString
The following code if added together on a calculator adds to 100, but if you
run my example in a vb form with a standard textbox and check the value of D
at the stop statement the value does not equal 100, but 99.999999999999986.
If you resume the program the TextBox1.text will show as 100.
(Why all these number you say - I have a program that stores a large list of
values and performs complex calculations on them).
Dim d As Double
d = d + 63.528588
d = d + 30.013506
d = d + 0.100045
d = d + 1.850833
d = d + 3.001351
d = d + 0.005002
d = d + 0.300135
d = d + 1.20054
If d <> 100 Then MsgBox("wtf!")
Stop
TextBox1.Text = d.ToString