I need to print all digets of some double number. I have following code:
double number;
while (number != floor (number)) number = number * 10;
But when number = 0.222
, I have following result 22200000000000004
. How can I avoid this inaccuracy.
P.S. I can use only double
, so I can't parse this like a string
.