This thread has details of similar problems, along with two solutions (setPrecisionMode is preferred if your compiler supports it) and a clear explanation of why the problem occurs.