#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
	while(1){
int d,e;
cin>>d>>e;
if(d==0)break;
double ans= (double)(e+d);
for(int i=0;i<=d/2;i++){
	int x=i;
	int y=d-i;
	double temp=sqrt(x*x+y*y);
ans=min(ans,abs(temp-e));
//cout<<temp<<endl;
}
cout<<ans<<endl;
}
return 0;
}

