I'm making a code to convert binary numbers between 0 and 1 to decimal. I made the code, tested with 0.1(equivalent to 0.5 in decimal) and it worked. When I tested it with 0.01 and 0.001 I was given the wrong answers(albeit close). I went to python tutor and found that when going for the second iteration, it would fail to transform 0.1 float into string. it would return "0.09999999999999964". Is there another way to make this conversion?
This is an algorithm from numeric method conversion.