|
-
Jan 12th, 2010, 08:13 PM
#1
Thread Starter
Member
Numbers funny business - please help
Could anyone explain the following for me because I am completely baffled:
int(2.01*100) returns 200
int(2.05*100) returns 204
but as expected
int(2.02*100) returns 202
int(2.06*100) returns 206
int(2.09*100) returns 209
and
int(201) returns 201
int(205) returns 205
Before you ask why do I need to use Int it is because the first number, which in my code is a variable, may have more than two decimal places.
And another baffler which probably is behind the results above
Dim Number As Double = 2.01 * 100 'returns 200.99999999999997
Dim Number As Double = 2.05 * 100 'returns 204.99999999999997
Please help me I am going crazy here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|