Thanks for all your explanations.
However, problem remains when i use while-loop.
And it is not easy to just use int value in loop condition.
How should i modify if i have to use the condition "x<0.8"?
yep, your explanations are the same as what my professors said.
I understand now that floating point is an approximate representation of real numbers and never use floating point to make comparison.
But my program is about computational physics, ........you know,......... i use fractional number and real number very often .....╮(╯▽╰)╭
If you were testing for two floating-point numbers being equal, then rather than doing a direct comparison, subtract one from the other and test if the absolute value of the result is smaller than some limit.