Serial monitor outputs 1023 for a float value all of a sudden.

Here is my code :

int phase1 = 3; // input pin for first phase
int phase2 = 5; // input pin for second phase
int phase3 = 6; //input pin for third phase
int rt = 10; //rest time

void delayprint(double x,double y, double  r, int rt){
  for(int i=0;i<rt;i++){
  //Serial.print(x);
  //Serial.print(" ");
  //Serial.print(y);
  //Serial.print(" ");
  Serial.print(r);
  Serial.print(" ");
  Serial.println(x+y);
  //Serial.print(" ");
  //Serial.print(y+r);
  //Serial.print(" ");*/
  //Serial.println(r+x);
  
  delay(1);}
}
  
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  //Serial.print(1);
  analogWrite(phase2,0);
}

void loop() {
  // put your main code here, to run repeatedly:
analogWrite(phase1,1023); // step 1
//analogWrite(phase2,0);
analogWrite(phase3,511);

delayprint(1,0,0.5,rt);

//analogWrite(phase1,1023); //step 2
analogWrite(phase2,511);
analogWrite(phase3,0);

delayprint(1,0.5,0,rt);

analogWrite(phase1,511); //step 3
analogWrite(phase2,1023);
//analogWrite(phase3,0);

delayprint(0.5,1,0,rt);

analogWrite(phase1,0);//step 4
//analogWrite(phase2,1023);
analogWrite(phase3,511);

delayprint(0,1,0.5,rt);

//analogWrite(phase1,0); //step 5
analogWrite(phase2,511);
analogWrite(phase3,1023);

delayprint(0,0.5,1,rt);

analogWrite(phase1,511); //step 6
analogWrite(phase2,0);
//analogWrite(phase3,1023);

delayprint(0.5,0,1023,rt);
}

The issue is the value r takes 1023 in the serial monitor which should not be possible.
I am using a Arduino Uno r3.

First time encountering this error.

Here is the serial monitor output:

0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.00 1.50
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
0.50 1.00
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1.00 0.50
1023.00 0.50 //RUN TIME ERROR HERE 
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50
1023.00 0.50

Is the issue with my Arduino board?

Why do you think it should not be possible?

It seems like the expected behavior from this line of your code:

Hunter_Zolomon:

delayprint(0.5,0,1023,rt);