I am writing a custom library. While debugging it i placed some “Serial.println”.

The whole thing is weird…

One code chunk:

```
Serial.println(proportions_Sgn[0]);
Serial.println(proportions_Sgn[1]);
float acceleratingDistance_Pr = speedPin_PrDivS * accelerationTime_S;
float *distanceSegments_Pr = new float[2];
float speed_PrDivS;
if (acceleratingDistance_Pr < distanceTotal_Pr) {
distanceSegments_Pr[0] = distanceTotal_Pr * 0.5F;
distanceSegments_Pr[1] = 0;
duration_S[0] = sqrt(distanceTotal_Pr / accelerationPin_PrDivSPow2);
duration_S[1] = 0;
speed_PrDivS = duration_S[0] * accelerationPin_PrDivSPow2;
}
else {
distanceSegments_Pr[0] = acceleratingDistance_Pr * 0.5F;
distanceSegments_Pr[1] = distanceTotal_Pr - acceleratingDistance_Pr;
duration_S[0] = accelerationTime_S;
duration_S[1] = distanceSegments_Pr[1] / speedPin_PrDivS;
speed_PrDivS = speedPin_PrDivS;
}
for (uint8_t a = 0; a < DriverCount; a++) {
accelerationPin_SgnPrDivSPow2[a] = accelerationPin_PrDivSPow2 * proportions_Sgn[a];
speed_SgnPrDivS[a] = speed_PrDivS * proportions_Sgn[a];
for (uint8_t b = 0; b < 2; b++)
distanceSegments_SgnPr[a][b] = distanceSegments_Pr[b] * proportions_Sgn[a];
}
Serial.println(proportions_Sgn[0]);
Serial.println(proportions_Sgn[1]);
```

Returns in serial:

1.00

1.00

0.00

1.00

And I have Absolutely no idea what is happening.

The thing that is worse is that if I add two prints more:

```
Serial.println(proportions_Sgn[0]);
Serial.println(proportions_Sgn[1]);
float acceleratingDistance_Pr = speedPin_PrDivS * accelerationTime_S;
float *distanceSegments_Pr = new float[2];
float speed_PrDivS;
if (acceleratingDistance_Pr < distanceTotal_Pr) {
distanceSegments_Pr[0] = distanceTotal_Pr * 0.5F;
distanceSegments_Pr[1] = 0;
duration_S[0] = sqrt(distanceTotal_Pr / accelerationPin_PrDivSPow2);
duration_S[1] = 0;
speed_PrDivS = duration_S[0] * accelerationPin_PrDivSPow2;
}
else {
distanceSegments_Pr[0] = acceleratingDistance_Pr * 0.5F;
distanceSegments_Pr[1] = distanceTotal_Pr - acceleratingDistance_Pr;
duration_S[0] = accelerationTime_S;
duration_S[1] = distanceSegments_Pr[1] / speedPin_PrDivS;
speed_PrDivS = speedPin_PrDivS;
}
Serial.println(proportions_Sgn[0]);
Serial.println(proportions_Sgn[1]);
for (uint8_t a = 0; a < DriverCount; a++) {
accelerationPin_SgnPrDivSPow2[a] = accelerationPin_PrDivSPow2 * proportions_Sgn[a];
speed_SgnPrDivS[a] = speed_PrDivS * proportions_Sgn[a];
for (uint8_t b = 0; b < 2; b++)
distanceSegments_SgnPr[a][b] = distanceSegments_Pr[b] * proportions_Sgn[a];
}
Serial.println(proportions_Sgn[0]);
Serial.println(proportions_Sgn[1]);
```

Returns in Serial:

1.00

1.00

1.00

1.00

1.00

1.00

As if the program changed how things are calculated somehow?

I have been struggling with this for past day, and I am at wit’s end