Why it's engage IF while condition is FALSE

Why it’s entering to IF when (millis) 263971 - 115252 (currentMillis - previousMillis) equal to 148719 which is more than interval = 120000
While IF condition: currentMillis - previousMillis <= interval says engage when less interval.

unsigned long previousMillis = 0; 
const long interval = 120000;         

 

void loop() {


    
    float value = client.getValue(ID);
    delay(100);
    
    Serial.print("Value before if: ");  // 
    Serial.println(value);

     Serial.print("millis: ");
    Serial.println(millis());
  if (value == 1.00)  {  // Gotcha command from Google home
      
digitalWrite(garage,value);   // Change pin value - Switch relay on and off
delay(800); // Press and hold garage button for X sec
digitalWrite(garage,0);


       Serial.print("Value after if: ");
       Serial.println(value);
    
     delay(20000); // Wait until door closed 20 sec.
float value=0.00; 
client.add(ID, 0.00);  // Sending back to Ubidots value 0
client.sendAll(false);
delay(100);

Serial.println(millis());

// gatekeeper test
  unsigned long currentMillis = millis();

     Serial.print("currentMillis - previousMillis : ");
     Serial.println(currentMillis - previousMillis);
     
  if (currentMillis - previousMillis <= interval) {

    
    previousMillis = currentMillis;   
     Serial.print("Hacked!!!");
     delay(60000); // 30 minutes
  }


   
  } // end of main if
 


    
}

Serial monitor output:

millis: 263971
Value after if: 1.00
Posting your variables: 
POST /api/v1.6/collections/values/?force=true HTTP/1.1
// Removed http output

[{"status_code": 201}]
0

285170
currentMillis - previousMillis : 115252
Hacked!!!

How and where is previousMillis declared ?

Sorry... forgot to add it (edited)

unsigned long previousMillis = 0;

The results I'm looking at don't say previousMillis = 115252 they say

"currentMillis - previousMillis : 115252"

When I learned maths 115252 was less than 120000. So where's the problem?

Steve

ugh...
Right. Thanks.

And another thing…

  if (value == 1.00)  {  // Gotcha command from Google home

You need to be really careful about comparing floating point values to exact constants. FP calculations are not exact, and you could end up with value == 0.9999976 or something. Caution calls for something like:

   if (abs(value - 1.0) < .0001)) {

What will you suggest against overflow (go back to zero) millis() function?

It's a non-event if all your variable are 'unsigned long' and you do all your comparisons using subtraction.