Hi Guys! Ive done buckets of trouble shooting on this, and i THINK i have identified where the problem is, but i cannt work out how to correct it. In short i am programming my CNC router (converting GCode into CNC movements)

I am working on circular interpolation. Because of the problems i have been having i have stripped back the code as far as i reasonably can. This sketch below parses out GCode instructions, interpolates 10 points between each GCode position and sends them to the Serial port in CSV format. This way i can quickly paste them into excel and live-update a scatter chart. I should be plotting a circle. Linerar interpolation works great, i am ending up with a (12 sided? Dodecagon?) circle.

circular interpolation is still causing me issues. I am using basic pythagarous to calculate the positions, and have put my calculations though a simple sketch that only does the pythagarous part and had the same result

If my reworking of the sketch on the link above is anything to go by, the problem is using pythagarous with large numbers.

If i run the sketch and leave the line as an INT, it runs through, but the math result is all wrong (repeatable on the super simple sketch)

if i make it a double, i get the correct result on the super simple sketch, but on the CNC sketch it freezes the program.

Why is the highlighted line freezing the sketch? Overflowing perhaps? How can i change the math to ensure the correct result (i think it would work if it was a double) without freezing the sketch up.

Hope this makes sense. Cheers. Olly. My sketch is attached, Line 339

```
int Xside = (Xmove+readI); // length of XSide
double Yside = sqrt (sq(h) - sq(Xside)); // <<<<<< Curves??
```

incidentally, h = 3000, XSide = approx 3000

plotpointsforexcel2.ino (15.5 KB)