1

Problem is to find the equation of a circle given three points. Got the math part down, but I'm having trouble getting the answer in the right format:

(x-Cx)^2+(y-Cy)^2=r^2

Specs say two digits after the decimal, but drop trailing 0s and decimals when appropriate. Here's the string I'm returning:

"(x-{0:.3g})^2+(y-{1:.3g})^2={2:.3g}^2".format(Cx, Cy, r)"

Here is an example:

Cx: 6.0000000000000000002 Cy: 5.74999999... r: 3.25

Result: "(x-6.00)^2+(y-5.75)^2=3.25^2"

Expecting: "(x-6)^2+(y-5.75)^2=3.25^2"

Edit: The code in question

0 Answers0