Can someone explain this code to me for the prlb make smaller bigger (MSB)

include
include <math.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
long a,b,x,y;
cin>>a>>b>>x>>y;
long double c=0;
long double r1,r2;
if(a>=b)
cout<<0<<endl;
else if(x==1 && y==1)
cout<<-1<<endl;
else{
r1=a;
r2=b;
while(r1<b && r2>a){
r1=r1*x;
r2=floor(r2/y);
c++;
}
cout<<c<<endl;
}
}
return 0;
}