So I am building a camera slider that uses two stepper motors. Those steppers have some gearing and I need to calculate some values only once. So I moved all those calculations into the call below. If I put these calculations into the loop, the steppers move awefully slow. I suspect because the loop time got a whole lot longer.

So the question is: Do the calculations in the code below require a lot of processing power from the Arduino Mega? Is there a way to estimate how much the loop would get longer if it has to do these calculations?

I solved the problem now by only calling the Standard Calculations () once, but it would be interesting to know why they take so long.

```
void StandardCalculations() //Call this once when the process starts.
{
xDistanceInSteps = (int)(xDistance / XmmPerStep); //calculates the number of steps required to move from one x position to the next given the xDistance set by the user.
NumberOfAngles = (90 / (SmallAngle * 0.1)); //checked it, it is correct. /10 because the input is 14° instead of 1.4°
ArcLengthPerAngle = (((SmallAngle * 0.1) / 360) * 2 * 3.141 * SliderLength * 10); // This comes from the arc length formula in degrees. The times 10 comes from cm to mm for the slider length.
Serial.print("Arc Length Per Angle = ");
Serial.println(ArcLengthPerAngle);
SliderEndPosition = ((SliderLength * 10) / XmmPerStep);
Serial.print("SliderEndPosition = ");
Serial.println(SliderEndPosition);
Serial.print("Number of Angles = ");
Serial.println(NumberOfAngles);
}
```