General information
Category:
Coding, syntax & commands
Jesse, Fred:
Try this in VBA:
Dim x As Double
x = 3.999999999999999
MsgBox x
MsgBox Int(x)
and you will get the same results as in VFP. In fact, if you do it in the Word VBA (I have not tried with the other Office programs), the line x = 3.999999999999999 will display as x=4#. As I tried to explain in an earlier post, this is due to the fact that most fractions (3999999999999999 / 1000000000000000 in this case) don't have an finite binary representation. The "problem" is that computer works with 0 and 1, not 0,1,2,..9 and thus you are tempted to believe that 3.999999999999999 has an finite representation (because it has an finite number of digits after the decimnals) when in fact it doesn't. Truth is, the binary representation of that number represents a range of number.
Hope I am more clear this time.
Daniel
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only