Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rounding differences between W2K and XP ???
Message
General information
Forum:
Visual Basic
Category:
Installation, Setup and Configuration
Miscellaneous
Thread ID:
00667375
Message ID:
00668755
Views:
30
I tried something else:
Private Sub Command2_Click()
Dim intI As Integer
Dim sngValue As Single

   sngValue = 5511.4
   For intI = 1 To 20
       sngValue = Format(sngValue + 0.01, "0.00")
       Debug.Print intI, sngValue, Format(sngValue / 2, "0.00")
   Next intI
End Sub
Here are the results under XP (some results are the same 3 times and others are there only once):

1 5511.41 2755.70
2 5511.42 2755.71
3 5511.43 2755.72
4 5511.44 2755.72
5 5511.45 2755.72
6 5511.46 2755.73
7 5511.47 2755.74
8 5511.48 2755.74
9 5511.49 2755.74
10 5511.5 2755.75
11 5511.51 2755.76
12 5511.52 2755.76
13 5511.53 2755.76
14 5511.54 2755.77
15 5511.55 2755.78
16 5511.56 2755.78
17 5511.57 2755.78
18 5511.58 2755.79
19 5511.59 2755.80
20 5511.6 2755.80

Under W2K, I get (everything is there twice):

1 5511.41 2755.71
2 5511.42 2755.71
3 5511.43 2755.72
4 5511.44 2755.72
5 5511.45 2755.73
6 5511.46 2755.73
7 5511.47 2755.74
8 5511.48 2755.74
9 5511.49 2755.75
10 5511.5 2755.75
11 5511.51 2755.76
12 5511.52 2755.76
13 5511.53 2755.77
14 5511.54 2755.77
15 5511.55 2755.78
16 5511.56 2755.78
17 5511.57 2755.79
18 5511.58 2755.79
19 5511.59 2755.80
20 5511.6 2755.80


?????
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform