What causes my variable to get reset?

Hi all, if someone can help me…

I’m setting up a tracking system with a 9 axis IMU. My goal is ultimately to point a yagi antenna toward a moving satellite and track it - at least for part of it’s path overhead.

So I’m doing some testing and initial set up. I’m using a simple RCA antenna rotator with a couple relays. One relay for Clockwise rotation. And another relay for CounterClockwise rotation.

Can you look at this piece and tell me why “myNumber” is getting reset to zero?

pos is actual posion (or “heading”) from the magnetometer.
myNumber is what user inputs. The arduino then compares myNumber to pos.

if ((myNumber <= pos+1 && myNumber >= pos-1)||(myNumber == 0))
{
    digitalWrite(RelayC,LOW);
    digitalWrite(RelayCC,LOW);
    delay(100);
    Serial.println("Enter desired position");
    while (Serial.available()==0){
    } 
    myNumber=Serial.parseFloat();
}

if (myNumber<pos)
{
    Serial.println("myNumber is less than psi");
    digitalWrite(RelayCC,HIGH);
    delay(100);
}

if (myNumber>pos)
{
    Serial.println("myNumber is greater than psi");
    digitalWrite(RelayC,HIGH);
    delay(100); 
}

I originally had this in void setup

Serial.println("Enter desired position");
    while (Serial.available()==0){
    } 
    myNumber=Serial.parseFloat();

and it worked fine. But I decided to move it in the conditional statement so once it reaches the desired position, I could try inputting another location and have a second go at it, but now myNumber keeps getting reset to zero, it immediately stops, and I don’t know why. Thanks, Gene

One quick way is to use ctrl-f in the IDE to do a "find" of all the places you use "myNumber". Just posting snippets of code helps no one.

Paul