If you encounter such problems, they you should learn about
computational mathematics. Problem is: usual math doesn't work on computers, as it's assumed, that precision is infinite in usual math, but in reality precision is finite, so you should learn about calculation errors and how they accumulate with certain operations. As I remember, absolute errors accumulate, when using addition, and relative errors accumulate, when using multiplication. When error exceeds your precision, your result becomes uncertain. So you should use special computation methods, not just arbitrary computing from usual math.