Microsoft Windows 95 don't know calculation 
Author Message
 Microsoft Windows 95 don't know calculation

Microsoft Windows 95 don't know calculation

Hello All, run this code in Visual Basic:

 Dim n1, n2 As Double
 n1 = 458
 n2 = 454.98
 MsgBox n1 - n2

Why ???  458-454.98 = 3.0199999999998

I see this problem in Microsoft Access, Visual Basic 5.0 and delphi 3.0

Help Help Help Help Help Help Help Help Help Help Help Help
elp Help Help Help Help Help Help Help Help Help Help Help
Help Help Help Help Help Help Help Help Help Help Help Help
Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
ug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
???????????????????????????????????
458-454.98 = 3.0199999999998
???????????????????????????????????
Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
ug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
ug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug
Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug-Bug

--
Wladimir Cesar Bianchi
Ribeirao Preto - SP - Brazil



Sat, 13 Nov 1999 03:00:00 GMT  
 Microsoft Windows 95 don't know calculation

Quote:
> Dim n1, n2 As Double

Sorry if I am stating the obvious, but did you realise that this code
will only make n2 a Double? n1 will be a Variant and VB will attempt
to cast the appropriate type when it is assigned (in this case an
Integer will be used).

Although this is not the cause of your problem, it is worth noting.

The correct syntax is:

Dim n1 As Double
Dim n2 As Double



Sun, 14 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Microsoft Windows 95 don't know calculation

2. Microsoft Windows 95 don't know calculation

3. Application runs with Windows 95/NT, but doesn't work with Windows 98

4. it's work with windows NT not with Windows 95

5. One of two functions doesn't function on Windows 95 (i does on Windows NT)

6. Login Off's In Windows '95/'98

7. Vb thunder Cooltips don't display on Win 95 machine

8. Microsoft VB doesn't know how to talk to Microsoft FoxPro

9. Microsoft VB doesn't know how to talk to Microsoft FoxPro

10. build a search function similar to Microsoft Help in Windows 95

11. Build a search function similar to Microsoft Help in Windows 95

12. Windows 95 B, Setup Wizard Issues Setup.EXE on Windows 95 A

 

 
Powered by phpBB® Forum Software