Varad, The .NET Guy!

Exploring the excitement of Microsoft .NET and much more..

VB.NET:Double precision problem

A strange problem in VB.NET code.
Sample code:
Dim x As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
x = 4551.55 + 139978.05
MsgBox(x)
End Sub 
From the above given sample code, while in break mode the value of 'x' is 144529.59999999998
but in the message box it gives 144529.6
But the same code works fine in VB6.0 
Why is this happening? Any clues...

Comments

TrackBack said:

Google
# August 8, 2004 12:18 PM

TrackBack said:

Fikele
# August 8, 2004 12:21 PM