i have made a program and its output is sometimes something like 1.0000005 . that's pretty annoying but i can get it solved with some rounding. but when my answer should be 1.3333333 for example i also get the precision problem and i get like 1.333333339 . i can't use a simple round to solve this so could anyone tell me how to get the right value?
I don't think there's an easy answer. But judging by the examples quoted, your results have limited precision. I'd recommend using double or long double, which should be better than float. But that merely pushes the problem further along into the later digits.