def getpoints(r):
    cx = 0
    rt = int(r*10)
    for i in range(rt*10+1):
        cy = math.sqrt(r**2-cx**2)  #circle formula
        print(cx, cy)
        x.append(cx)
        y.append(cy)
        cx = cx + 0.1
This is part of my code. It is meant to calculate plots on a circle
x at the start gets 0.1 added to it each iteration, but as it goes on it starts to get things like 1.6000000000000003 as the output for x. This causes a problem where, for example r = 2.5 and x = 2.400000000000001, then it adds 0.1 and it tries to square root r^2 - x^2 but x is bigger than r, even though it shouldn't be 
By x I mean cx
I have tried math.fabs() which to me seemed like it might work but it didn't.
How do I fix this. It only needs to be accurate to 0 decimal places, just not sqrt negative numbers
 I feel like I'm being dumb here
 
    