Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / October 2007



Tip: Looking for answers? Try searching our database.

VB Enigma multiplying a double data type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Giallombardo - 17 Oct 2007 20:27 GMT
Can someone solve the following puzzle for me? I ran across this in one
of my projects and can't believe this is how VB works. Somehow VB thinks
that 8.62 * 100 <> 862. I have a work-around but really would like to
know why this doesn't work.

Private Sub Form_Load()
 Dim Amt1 As Double
 Dim Amt2 As Double
 Dim Amt3 As Double

 Amt1 = 862
 Amt2 = 8.62
 
 Amt3 = Amt2 * 100

 If Amt1 <> Amt3 Then
   MsgBox ("All is lost")
 End If

 If Amt1 = Amt2 Then
   MsgBox ("All is right with the world")
 End If
End Sub
Ken Halter - 17 Oct 2007 20:29 GMT
> Can someone solve the following puzzle for me? I ran across this in one
> of my projects and can't believe this is how VB works. Somehow VB thinks
> that 8.62 * 100 <> 862. I have a work-around but really would like to
> know why this doesn't work.

Boy... this is definitely a faq this month!

See:
http://groups.google.com.my/group/microsoft.public.vb.general.discussion/msg/74b
7abbe3645bd1b


Signature

Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm

NeilH - 18 Oct 2007 08:21 GMT
Try using Google as this is a FAQ!!!!

> Can someone solve the following puzzle for me? I ran across this in one
> of my projects and can't believe this is how VB works. Somehow VB thinks
[quoted text clipped - 21 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.