DilemmaDave
New Member
- Joined
- Apr 6, 2012
- Messages
- 7
Hi All,
This is driving me batty! The int() function returns obviously wrong results and I can't figure out why.
I've simplified things with the following bit of code:
Sub Int_Error()
x = 39.8
y = x * 100
z = Int
End Sub
If you step through this and watch the values , 'z' evaluates as 3979, instead of the correct value of 3980.
I've tested this on two different systems and have the same issue. I'm using Excel 2003, SP3.
z=Int(3980) returns the correct value, so it seems it only happens when the argument is passed as a variable.
This happens consistently with some specific values, 39.8 being one of those values.
Thoughts? Ideas?
Cheers,
David W.
This is driving me batty! The int() function returns obviously wrong results and I can't figure out why.
I've simplified things with the following bit of code:
Sub Int_Error()
x = 39.8
y = x * 100
z = Int
End Sub
If you step through this and watch the values , 'z' evaluates as 3979, instead of the correct value of 3980.
I've tested this on two different systems and have the same issue. I'm using Excel 2003, SP3.
z=Int(3980) returns the correct value, so it seems it only happens when the argument is passed as a variable.
This happens consistently with some specific values, 39.8 being one of those values.
Thoughts? Ideas?
Cheers,
David W.