Help optimizing a function

I'm probably not seeing something, but if you are calling the functions to get the max or min value in the array and those values are constantly updated, send the most recent value in and have a variable defined in each with the static storage class:

float get_array_max_value(float val){
   static long tempMax = -100000F;
 
   if (val >= tempMax)
      tempMax = val;
  return tempMax;
}

float get_array_min_value(float val){
   static long tempMin = 100000F;
 
   if (val <= tempMin )
      tempMin = val;
  return tempMin ;
}

If you are only updating the last value in the array, why read the first 4 values when you know which one is the max value from a previous call? What am I missing?