Problems with Index and ESP32

Hi, I’m going to continue the discussion about Index here, in a separate thread, which seems to me more appropriate.
lib ver 1.5, ESP32, DRV8302 and AMT102-v, with 12v power supply.
When doing calibration, if the encoder is near the INDEX position, it goes in an endless reboot loop.
Maybe it is related to an issue Owen_Williams mentioned HERE

Here’s a video to document this:

I’ve just changed the casting from ‘float’ to ‘double’ as suggested from Owen_Williams and the bug isn’t there anymore.

void Encoder::handleIndex() {
  if(hasIndex()){
    int I = digitalRead(index_pin);
    if(I && !I_active){
      // align encoder on each index 
      if(index_pulse_counter){
        long tmp = pulse_counter;
        // corrent the counter value
        //pulse_counter = round((float)pulse_counter/(float)cpr)*cpr;
        pulse_counter = round((double)pulse_counter/(double)cpr)*cpr;
        // preserve relative speed
        prev_pulse_counter += pulse_counter - tmp;
      } else {
      // initial offset
        index_pulse_counter = pulse_counter;
      }
    }
    I_active = I;
  }
}

Thank you!