Getting rpm with quad encoders

I am new at robotc, and with the season over, I am going to take one of the robots to practice on. We used IMEs to work our single flywheel but would like to improve it greatly.
I saw lots of quad encoders mounted on the flywheel axle to measure the rpm or ticks.
My question is:
What is the proper formula to get the rpm with info from the quad ender?
I want to experiment with both PID and bang bang.
Thanks for any and all help

Hi, I use Prose, but I think that the code should apply to RobotC as well. This is how I did it all year, and it may be flawed but it was the best I could do.


Encoder speedEnc;
int encoderSpeedOp(){
  int old;
  int new;
  
  old = encoderGet(speedEnc);
  if(old > 100000){
    encoderReset(speedEnc);
    old = 0;
  }
  delay(20);
  new = encoderGet(speedEnc);
  return new - old;
}

Potentially you could use a timer to make it more exact.