Tuesday, March 31, 2009

Floating Point Error

Simple math will show you that ((4.9-4)*10-9)*10^15=0; however your computer will tell you that it's 3.55. This is because the computer is approximating 4.9 and so most of the time the error is so small it doesn't matter, but if you add up a bunch of these errors then you get a big error.

I always knew there was this precision error in computers, I just didnt think I would ever run into the problem...well now I have. I now must re-specifying my model because my computer is not smart enough to calculate things precisely. This probably would have happened at some point anyway, but I really wanted to have a working algorithm before I worried about the interpretation of what I'm doing.

No comments:

Post a Comment