Reputation: 659
doing a simple subtraction such as this:
Dim a, b As Double
a = 81.4
b = 76.0
MsgBox(a - b)
you would expect it to result in 5.4 but instead you get 5.4000000000000001 what is going on?
Upvotes: 0
Views: 214
Reputation: 41077
floating point numbers, even double precision floating point numbers, are not 'real' numbers which have infinite precision.
See What Every Computer Scientist Should Know About Floating-Point Arithmetic
Upvotes: 2