#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int t;
    LL a,b;
    cin>>t;

    while(t--)
    {
        cin>>a>>b;
        double ans;
        if(a == 0 || b == 0) ans = 1;
        else
        {
            if(a > (4*b))
            {
                LL a1 = 4*b, a2 = a - a1;
                ans = (((a1 * a1) / 8.0) + (b * (a + a2))) / (2.0 * a * b);
            }
            else ans = (a + (8.0 * b)) / (16.0 * b);
        }

        setp(9);
        cout<<ans<<'\n';
    }

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int t;
    LL a,b;
    cin>>t;

    while(t--)
    {
        cin>>a>>b;
        double ans = (a + (8.0 * b)) / (16.0 * b);
        setp(9);
        cout<<ans<<'\n';
    }

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	speed
	int tt;cin>>tt;
	while(tt--)
	{
		int a, b;cin>>a>>b;
		double ans=0.5;
		double t=min(b*1.0,a/4.0);
		ans+=((a*t-2*t*t)/(2*a*b));
		printf("%.10lf\n",ans);
	}
}


//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	speed
	int tt;cin>>tt;
	while(tt--)
	{
		int a, b;cin>>a>>b;
		if(b==0){printf("%.10lf\n",1.0);}
		if(a==0){printf("%.10lf\n",0.5);}
		double ans=0.5;
		double t=min(b*1.0,a/4.0);
		ans+=((a*t-2*t*t)/(2*a*b));
		printf("%.10lf\n",ans);
	}
}


//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	speed
	int tt;cin>>tt;
	while(tt--)
	{
		int a, b;cin>>a>>b;
		if(b==0){printf("%.10lf\n",1.0);continue;}
		if(a==0){printf("%.10lf\n",0.5);continue;}
		double ans=0.5;
		double t=min(b*1.0,a/4.0);
		ans+=((a*t-2*t*t)/(2*a*b));
		printf("%.10lf\n",ans);
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a*b==0){
        if(b==0){
            printf("%.10f\n",1);
        }
        else {
            printf("%.10f\n",0.5);
        }
    }
    else if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(fabs(a*b)<1e-8){
        if(fabs(a)<1e-8&&fabs(b)<1e-8){
            printf("%.10f\n",1);
        }
        else if(fabs(a)<1e-8){
            printf("%.10f\n",0.5);
        }
        else{
            printf("%.10f\n",1);
        }
    }
    else if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(fabs(a*b)<1e-8){
        if(fabs(a)<1e-8&&fabs(b)<1e-8){
            printf("%.10f\n",1.0);
        }
        else if(fabs(a)<1e-8){
            printf("%.10f\n",0.5);
        }
        else{
            printf("%.10f\n",1.0);
        }
    }
    else if(b>=a/4.0){
        printf("%.10f\n",(a+8.0*b)/(16.0*b));
    }
    else{
        printf("%.10f\n",(a-b)/a);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a*b==0){
        printf("%.10f\n",0);
    }
    else if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a*b==0){
        if(a==0&&b==0){
            printf("%.10f\n",1);
        }
        else if(a==0){
            printf("%.10f\n",0.5);
        }
        else{
            printf("%.10f\n",1);
        }
    }
    else if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=a*(2.0*b)-b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(fabs(a*b)<1e-8){
        if(fabs(a)<1e-8&&fabs(b)<1e-8){
            printf("%.10f\n",1);
        }
        else if(fabs(a)<1e-8){
            printf("%.10f\n",0.5);
        }
        else{
            printf("%.10f\n",1);
        }
    }
    else if(a<=4.0*b){
        double S1=a*0.125+b;
        double S2=(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b;
        double S2=a;
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in", "r", stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T = read();
    for(int ti = 1; ti <= T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti) {
    double a, b;
    scanf("%lf%lf", &a, &b);
    if(a == 0 && b == 0)
        puts("1");
    else if(4 * b > a)
        printf("%.6f\n", 0.5 + (1.0 * a) / (16 * b));
    else
        printf("%.6f\n", 1.0 - (1.0 * b) / a);
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read() {
    int x = 0;
    int f = 0;
    char c;
    do {
        c = getchar();
        if(c == '-')
            f = 1;
    } while(c < '0' || c > '9');
    do {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    } while(c >= '0' && c <= '9');
    return f ? -x : x;
}

inline void _write(int x) {
    if(x > 9)
        _write(x / 10);
    putchar(x % 10 + '0');
}

inline void write(int x) {
    if(x < 0) {
        putchar('-');
        x = -x;
    }
    _write(x);
    putchar('\n');
}

void TestCase(int ti);

int main() {
#ifdef Yinku
    freopen("Yinku.in","r",stdin);
    //freopen("Yinku.out","w",stdout);
#endif // Yinku
    int T=read();
    for(int ti=1; ti<=T; ti++)
        TestCase(ti);
}

/*---  ---*/

void TestCase(int ti){
    double a,b;
    scanf("%lf%lf",&a,&b);
    if(a*b==0){
        if(a==0&&b==0){
            printf("%.10f\n",1);
        }
        else if(a==0){
            printf("%.10f\n",0.5);
        }
        else{
            printf("%.10f\n",0);
        }
    }
    else if(a<=4.0*b){
        double S1=a*0.25*a*0.5+a*b;
        double S2=a*(2.0*b);
        printf("%.10f\n",S1/S2);
    }
    else{
        double S1=b*(4.0*b)*0.5;
        double S2=a*(2.0*b);
        printf("%.10f\n",(S2-S1)/S2);
    }

}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	int x, y;
	//cout << 1 / 0;
	while (cin >> x >> y) {
		ld a = x, b = y;
		ld res = 0;
		if (a == 0 && b == 0) {
			cout << "1\n";
			continue;
		}
		if (a == 0 && b != 0) {
			cout << "0.5\n";
			continue;
		}
		if (a != 0 && b == 0) {
			cout << "1\n";
			continue;
		}
		if (a / 4 <= b)
			res = (a * b + a * a / 8) / (2 * a * b);
		else
			res = (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		cout << res << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	for (; t; --t) {
		int x, y;
		cin >> x >> y;
		ld a = x, b = y;
		if (a / 4 <= b) {
			cout << setprecision(20) << (a * b + a * a / 8) / (2 * a * b);
		}
		else {
			cout << setprecision(20) << (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		}
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	for (; t; --t) {
		int x, y;
		cin >> x >> y;
		ld a = x, b = y;
		if (x == y && y == 0) {
			cout << "1\n";
			continue;
		}
		if (a / 4 <= b) {
			cout << setprecision(20) << (a * b + a * a / 8) / (2 * a * b);
		}
		else {
			cout << setprecision(20) << (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		}
		cout << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	int x, y;
	//cout << 1 / 0;
	while (cin >> x >> y) {
		ld a = x, b = y;
		if (x == y && y == 0) {
			cout << "1\n";
			continue;
		}
		if (a / 4 <= b) {
			cout << setprecision(20) << (a * b + a * a / 8) / (2 * a * b);
		}
		else {
			cout << setprecision(20) << (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		}
		cout << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	for (; t; --t) {
		int x, y;
		cin >> x >> y;
		ld a = x, b = y;
		cout << setprecision(20) << (a * b + min(b, a / 4) * a / 2) / (2 * b * a) << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	for (; t; --t) {
		int x, y;
		cin >> x >> y;
		ld a = x, b = y;
		if (a / 4 <= b) {
			cout << setprecision(20) << (a * b + a * a / 8) / (2 * a * b);
		}
		else {
			cout << setprecision(20) << (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		}
		cout << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	int x, y;
	//cout << 1 / 0;
	while (cin >> x >> y) {
		ld a = x, b = y;
		ld res = 0;
		if (2 * a * b == 0) {
			cout << "1\n";
			continue;
		}
		if (a / 4 <= b)
			res = (a * b + a * a / 8) / (2 * a * b);
		else
			res = (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		cout << res << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	int x, y;
	//cout << 1 / 0;
	while (cin >> x >> y) {
		ld a = x, b = y;
		ld res = 0;
		if (a == 0 && b == 0) {
			cout << "1\n";
			continue;
		}
		if (a == 0 && b != 0) {
			cout << "0.5\n";
			continue;
		}
		if (a != 0 && b == 0) {
			cout << "1\n";
			continue;
		}
		if (a / 4 <= b)
			res = (a * b + a * a / 8) / (2 * a * b);
		else
			res = (a * b + (b * (a - 4 * b)) + 2 * b * b) / (2 * a * b);
		cout << res << '\n';
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;

//template<typename T1, typename T2> chkmin(T1 & x, T2 & y) {if (x > y) x = y;}
//template<typename T1, typename T2> chkmax(T1 & x, T2 & y) {if (x < y) x = y;}

typedef long long ll;
typedef long double ld;

const ld EPS = 1e-9, INF = 1e9;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	int t;
	cin >> t;
	for (; t; --t) {
		int x, y;
		cin >> x >> y;
		ld a = x, b = y;
		cout << setprecision(20) << (a * b + a * a / 8) / (2 * b * a) << '\n';
	}
	return 0;
}


// best question solved so far
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front;
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
#define rep(i,n) for(ll i=0;i<n;i++)
#define mem(x,a) memset(x,a,sizeof(x))

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef map<ll,ll> spt;
typedef set<ll> si;
typedef multiset<ll>::iterator sit;
typedef map<ll,ll>::iterator mi;
typedef vector<ll>::iterator vit;
typedef vector<ii> vii;
typedef set<ii> sii;
typedef multiset<ll> msi;
typedef vector< vector<ll> > matrix;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
typedef tree<ii,null_type,greater<ii>,rb_tree_tag,tree_order_statistics_node_update> ost1;
template<class T> T chmin(T& a, T& b) { if(a>b) return a; }
template<class T> T chmax(T& a, T& b) { if(a<b) return b; }
const ll INF = 1e18;
const ll MOD = 998244353;
const ll N = 1e6 +5;
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
vi v[30];
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<setprecision(20);
    ll t;
    cin>>t;
    while(t--)
    {
        ld a,b,x,num,denom;
        cin>>a>>b;
        if(b==0)
        {
            cout<<1<<"\n";
            continue;
        }
        x=a/4.0;
        ld tot=2*a*b;
        if(x<=b){
        num=8*a*b+a*a;
        denom=8*tot;
        }
        else
        {
            num=tot-2*b*b;
            denom=tot;
        }
        ld ans=num/denom;
        cout<<ans<<"\n";
    }

}


// best question solved so far
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front;
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
#define rep(i,n) for(ll i=0;i<n;i++)
#define mem(x,a) memset(x,a,sizeof(x))

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef map<ll,ll> spt;
typedef set<ll> si;
typedef multiset<ll>::iterator sit;
typedef map<ll,ll>::iterator mi;
typedef vector<ll>::iterator vit;
typedef vector<ii> vii;
typedef set<ii> sii;
typedef multiset<ll> msi;
typedef vector< vector<ll> > matrix;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
typedef tree<ii,null_type,greater<ii>,rb_tree_tag,tree_order_statistics_node_update> ost1;
template<class T> T chmin(T& a, T& b) { if(a>b) return a; }
template<class T> T chmax(T& a, T& b) { if(a<b) return b; }
const ll INF = 1e18;
const ll MOD = 998244353;
const ll N = 1e6 +5;
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
vi v[30];
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<setprecision(20);
    ll t;
    cin>>t;
    while(t--)
    {
        ld a,b;
        cin>>a>>b;
        ld tot=2*a*b;
        ld num=8*a*b+a*a;
        ld denom=8*tot;
        ld ans=num/denom;
        cout<<ans<<"\n";
    }

}


// best question solved so far
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front;
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
#define rep(i,n) for(ll i=0;i<n;i++)
#define mem(x,a) memset(x,a,sizeof(x))

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef map<ll,ll> spt;
typedef set<ll> si;
typedef multiset<ll>::iterator sit;
typedef map<ll,ll>::iterator mi;
typedef vector<ll>::iterator vit;
typedef vector<ii> vii;
typedef set<ii> sii;
typedef multiset<ll> msi;
typedef vector< vector<ll> > matrix;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
typedef tree<ii,null_type,greater<ii>,rb_tree_tag,tree_order_statistics_node_update> ost1;
template<class T> T chmin(T& a, T& b) { if(a>b) return a; }
template<class T> T chmax(T& a, T& b) { if(a<b) return b; }
const ll INF = 1e18;
const ll MOD = 998244353;
const ll N = 1e6 +5;
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
vi v[30];
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<setprecision(20);
    ll t;
    cin>>t;
    while(t--)
    {
        ld a,b,x,num,denom;
        cin>>a>>b;
        if(b==0)
        {
            cout<<1<<"\n";
            continue;
        }
        else if(a==0)
        {
            cout<<0.5<<"\n";
            continue;
        }
        x=a/4.0;
        ld tot=2*a*b;
        if(x<=b){
        num=8*a*b+a*a;
        denom=8*tot;
        }
        else
        {
            num=tot-2*b*b;
            denom=tot;
        }
        ld ans=num/denom;
        cout<<ans<<"\n";
    }

}


// best question solved so far
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front;
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
#define rep(i,n) for(ll i=0;i<n;i++)
#define mem(x,a) memset(x,a,sizeof(x))

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef map<ll,ll> spt;
typedef set<ll> si;
typedef multiset<ll>::iterator sit;
typedef map<ll,ll>::iterator mi;
typedef vector<ll>::iterator vit;
typedef vector<ii> vii;
typedef set<ii> sii;
typedef multiset<ll> msi;
typedef vector< vector<ll> > matrix;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
typedef tree<ii,null_type,greater<ii>,rb_tree_tag,tree_order_statistics_node_update> ost1;
template<class T> T chmin(T& a, T& b) { if(a>b) return a; }
template<class T> T chmax(T& a, T& b) { if(a<b) return b; }
const ll INF = 1e18;
const ll MOD = 998244353;
const ll N = 1e6 +5;
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
vi v[30];
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<setprecision(20);
    ll t;
    cin>>t;
    while(t--)
    {
        ld a,b,x,num,denom;
        cin>>a>>b;
        if(b==0)
        {
            cout<<1;
            continue;
        }
        x=a/4.0;
        ld tot=2*a*b;
        if(x<=b){
        num=8*a*b+a*a;
        denom=8*tot;
        }
        else
        {
            num=tot-2*b*b;
            denom=tot;
        }
        ld ans=num/denom;
        cout<<ans<<"\n";
    }

}


// best question solved so far
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front;
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
#define rep(i,n) for(ll i=0;i<n;i++)
#define mem(x,a) memset(x,a,sizeof(x))

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef map<ll,ll> spt;
typedef set<ll> si;
typedef multiset<ll>::iterator sit;
typedef map<ll,ll>::iterator mi;
typedef vector<ll>::iterator vit;
typedef vector<ii> vii;
typedef set<ii> sii;
typedef multiset<ll> msi;
typedef vector< vector<ll> > matrix;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
typedef tree<ii,null_type,greater<ii>,rb_tree_tag,tree_order_statistics_node_update> ost1;
template<class T> T chmin(T& a, T& b) { if(a>b) return a; }
template<class T> T chmax(T& a, T& b) { if(a<b) return b; }
const ll INF = 1e18;
const ll MOD = 998244353;
const ll N = 1e6 +5;
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
vi v[30];
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<setprecision(20);
    ll t;
    cin>>t;
    while(t--)
    {
        ld a,b,x,num,denom;
        cin>>a>>b;
        x=a/4.0;
        ld tot=2*a*b;
        if(x<=b){
        num=8*a*b+a*a;
        denom=8*tot;
        }
        else
        {
            num=tot-2*b*b;
            denom=tot;
        }
        ld ans=num/denom;
        cout<<ans<<"\n";
    }

}


#include "bits/stdc++.h"
using namespace std;

#define MOD 998244353
#define PI 3.1415926535897932384
#define fastio std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long

int main(){

    fastio;

    int t;
    ll a, b;
    cin >> t;
    double need, area;
    while(t--){
        cin >> a >> b;
        area = 2*b*a;
        if(b == 0){
            if(a != 0)
                cout << "0.00000000\n";
            else
                cout << "1.00000000\n";
            continue;
        }
        if(a == 0){
            if(b < 0){
                cout << "1.00000000\n";
            }
            else
                cout << "0.00000000\n";
            continue;
        }
        if(area == 0){
            cout << "1.00000000" << "\n";
            continue;
        }
        if(4*b - a >= 0){
            need = (1.0*a*a)/8.0 + a*b;
        }
        else{
            need = 2*b*a - 2*b*b;
        }
        cout << fixed << setprecision(8) << (1.0*need) / (1.0*area) << "\n";
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define MOD 998244353
#define PI 3.1415926535897932384
#define fastio std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long

int main(){

    fastio;

    int t;
    ll a, b;
    cin >> t;
    double need, area;
    while(t--){
        cin >> a >> b;
        area = 2*b*a;
        if(b == 0){
            cout << "1.00000000\n";
            continue;
        }
        if(a == 0){
            cout << "0.50000000\n";
            continue;
        }
        if(4*b - a >= 0){
            need = (1.0*a*a)/8.0 + a*b;
        }
        else{
            need = 2*b*a - 2*b*b;
        }
        cout << fixed << setprecision(8) << (1.0*need) / (1.0*area) << "\n";
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define MOD 998244353
#define PI 3.1415926535897932384
#define fastio std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long

int main(){

    fastio;

    int t;
    ll a, b;
    cin >> t;
    double need, area;
    while(t--){
        cin >> a >> b;
        area = 2*b*a;
        if(b == 0){
            cout << "1.00000000\n";
            continue;
        }
        if(a == 0){
            if(b < 0){
                cout << "1.00000000\n";
            }
            else
                cout << "0.00000000\n";
            continue;
        }
        if(area == 0){
            cout << "1.00000000" << "\n";
            continue;
        }
        if(4*b - a >= 0){
            need = (1.0*a*a)/8.0 + a*b;
        }
        else{
            need = 2*b*a - 2*b*b;
        }
        cout << fixed << setprecision(8) << (1.0*need) / (1.0*area) << "\n";
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define MOD 998244353
#define PI 3.1415926535897932384
#define fastio std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long

int main(){

    fastio;

    int t;
    ll a, b;
    cin >> t;
    double need, area;
    while(t--){
        cin >> a >> b;
        area = 2*b*a;
        if(4*b - a >= 0){
            need = (1.0*a*a)/8.0 + a*b;
        }
        else{
            need = 2*b*a - 2*b*b;
        }
        cout << fixed << setprecision(8) << (1.0*need) / (1.0*area) << "\n";
    }

    return 0;
}


//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define sqr(x) ((x)*(x))
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=500000+10,maxn=2000000+10,inf=0x3f3f3f3f;

int main()
{
    int t;scanf("%d",&t);
    while(t--)
    {
        int a,b;scanf("%d%d",&a,&b);
        if(a==0)puts("0");
        else if(b==0)puts("1");
        else if(a<4*b)printf("%.12f\n",0.5+1.0*a/16/b);
        else printf("%.12f\n",1.0*(a-b)/a);
    }
    return 0;
}
/********************

********************/


//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define sqr(x) ((x)*(x))
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=500000+10,maxn=2000000+10,inf=0x3f3f3f3f;

int main()
{
    int t;scanf("%d",&t);
    while(t--)
    {
        int a,b;scanf("%d%d",&a,&b);
        if(a==0||b==0)puts("0");
        else if(a<4*b)printf("%.12f\n",0.5+1.0*a/16/b);
        else printf("%.12f\n",1.0*(a-b)/a);
    }
    return 0;
}
/********************

********************/


//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define sqr(x) ((x)*(x))
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=500000+10,maxn=2000000+10,inf=0x3f3f3f3f;

int main()
{
    int t;scanf("%d",&t);
    while(t--)
    {
        int a,b;scanf("%d%d",&a,&b);
        if(b==0)puts("1");
        else if(a==0)puts("0.5");
        else if(a<4*b)printf("%.12f\n",0.5+1.0*a/16/b);
        else printf("%.12f\n",1.0*(a-b)/a);
    }
    return 0;
}
/********************

********************/


//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define sqr(x) ((x)*(x))
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=500000+10,maxn=2000000+10,inf=0x3f3f3f3f;

int main()
{
    int t;scanf("%d",&t);
    while(t--)
    {
        int a,b;scanf("%d%d",&a,&b);
        if(a<4*b)printf("%.12f\n",0.5+1.0*a/16/b);
        else printf("%.12f\n",1.0*(a-b)/a);
    }
    return 0;
}
/********************

********************/


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	double a,b;
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(b==0){
			cout<<fixed<<setprecision(12)<<  1 <<endl;
		}
		else if(a>=4*b){
			cout<<fixed<<setprecision(12)<<  (a-b)/a  <<endl;
		}
		else{
			cout<<fixed<<setprecision(12)<< (2*a*b-((2*b-a/4)*a*0.5))/(2*a*b) <<endl;
		}
//		cout<<fixed<<setprecision(12)<<(count/double(n))<<endl;

	}
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	double a,b;
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(a>=4*b){
			cout<<fixed<<setprecision(12)<<  (a-b)/a  <<endl;
		}
		else{
			cout<<fixed<<setprecision(12)<< (2*a*b-((2*b-a/4)*a*0.5))/(2*a*b) <<endl;
		}
//		cout<<fixed<<setprecision(12)<<(count/double(n))<<endl;

	}
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	double a,b;
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(b==0){
			cout<<fixed<<setprecision(12)<<  1 <<endl;
		}
		else if(a==0){
			cout<<fixed<<setprecision(12)<<  0.5  <<endl;
		}
		else if(a>=4*b){
			cout<<fixed<<setprecision(12)<<  (a-b)/a  <<endl;
		}
		else{
			cout<<fixed<<setprecision(12)<< (2*a*b-((2*b-a/4)*a*0.5))/(2*a*b) <<endl;
		}
//		cout<<fixed<<setprecision(12)<<(count/double(n))<<endl;

	}
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t,a,b;cin>>t;
	while(t--){
		cin>>a>>b;
		if(a>=4*b){
			cout<<fixed<<setprecision(12)<<1<<endl;
		}
		else{
			cout<<fixed<<setprecision(12)<< 0.5+0.5*(a/double(8*b)) <<endl;
		}
//		cout<<fixed<<setprecision(12)<<(count/double(n))<<endl;

	}
}


//Catchharsh
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll t;
     cin>>t;
     while(t--)
     {
     	 ld a,b;
     	 cin>>a>>b;
     	if(a==0&&b==0)
     	{
     		cout<<1<<endl;continue;
     	}
     	else if(a==0)
     	{
     		cout<<0.50000<<endl;continue;
     	}
     	else if(b==0)
     	{
     		cout<<1<<endll
     		continue;
     	}
     	 ld a1,a2=2*b*a;
     	 if(4*b<=a)
     	 {
     	 	 a1=a2-2*b*b;
     	 }
     	 else
     	 {
     	 	ld cut=a/(ld)4;
     	 	a1=(a*(cut+2*b))/(ld)2;
     	 }
     	 ld ans=a1/(ld)a2;
     	 cout<<fixed<<setprecision(10)<<ans<<endl;
     }

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


//Catchharsh
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll t;
     cin>>t;
     while(t--)
     {
     	 ld a,b;
     	 cin>>a>>b;
     	if(a==0&&b==0)
     	{
     		cout<<1<<endl;continue;
     	}
     	else if(a==0)
     	{
     		cout<<0.50000<<endl;continue;
     	}
     	else if(b==0)
     	{
     		cout<<1<<endl;
     		continue;
     	}
     	 ld a1,a2=2*b*a;
     	 if(4*b<=a)
     	 {
     	 	 a1=a2-2*b*b;
     	 }
     	 else
     	 {
     	 	ld cut=a/(ld)4;
     	 	a1=(a*(cut+2*b))/(ld)2;
     	 }
     	 ld ans=a1/(ld)a2;
     	 cout<<fixed<<setprecision(10)<<ans<<endl;
     }

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


//Catchharsh
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll t;
     cin>>t;
     while(t--)
     {
     	 ld a,b;
     	 cin>>a>>b;
     	 ld a1,a2=2*b*a;
     	 if(4*b<=a)
     	 {
     	 	 a1=a2-2*b*b;
     	 }
     	 else
     	 {
     	 	ld cut=a/(ld)4;
     	 	a1=(a*(cut+2*b))/(ld)2;
     	 }
     	 ld ans=a1/(ld)a2;
     	 cout<<fixed<<setprecision(10)<<ans<<endl;
     }

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


#include <bits/stdc++.h>
using namespace std;

const double EPS = 1e-10, DINF = 1e100;

// PUNTO

struct pt { // for 3D add z coordinate
  double x,y;
  pt(double x, double y):x(x),y(y){}
  pt(){}
  double norm2(){return *this**this;}
  double norm(){return sqrt(norm2());}
  bool operator==(pt p){return abs(x-p.x)<EPS&&abs(y-p.y)<EPS;}
  pt operator+(pt p){return pt(x+p.x,y+p.y);}
  pt operator-(pt p){return pt(x-p.x,y-p.y);}
  pt operator*(double t){return pt(x*t,y*t);}
  pt operator/(double t){return pt(x/t,y/t);}
  double operator*(pt p){return x*p.x+y*p.y;}
  // pt operator^(pt p){ // only for 3D
  //return pt(y*p.z-z*p.y,z*p.x-x*p.z,x*p.y-y*p.x);}
  double angle(pt p){ // redefine acos for values out of range
  return acos(*this*p/(norm()*p.norm()));}
  pt unit(){return *this/norm();}
  double operator%(pt p){return x*p.y-y*p.x;}
  // 2D from now on
  bool operator<(pt p)const{ // for convex hull
  return x<p.x-EPS||(abs(x-p.x)<EPS&&y<p.y-EPS);}
  bool left(pt p, pt q){ // is it to the left of directed line pq?
  return (q-p)%(*this-p)>EPS;}
  pt rot(pt r){return pt(*this%r,*this*r);}
  pt rot(double a){return rot(pt(sin(a),cos(a)));}
};
pt ccw90(1,0);
pt cw90(-1,0);

// LINEA

int sgn2(double x){return x<0?-1:1;}

struct ln {
  pt p,pq;
  ln(pt p, pt q):p(p),pq(q-p){}
  ln(){}
  bool has(pt r){return dist(r)<EPS;}
  bool seghas(pt r){return has(r)&&(r-p)*(r-(p+pq))-EPS<0;}
  // bool operator /(ln l){return (pq.unit()^l.pq.unit()).norm()<EPS;}  // 3D
  bool operator/(ln l){return abs(pq.unit()%l.pq.unit())<EPS;}          // 2D
  bool operator==(ln l){return *this/l&&has(l.p);}
  pt operator^(ln l){ // intersection
  if(*this/l)return pt(DINF,DINF);
  pt r=l.p+l.pq*((p-l.p)%pq/(l.pq%pq));
  //if(!has(r)){return pt(NAN,NAN,NAN);}           // check only for 3D
  return r;
  }
  double angle(ln l){return pq.angle(l.pq);}
  int side(pt r){return has(r)?0:sgn2(pq%(r-p));}  // 2D
  pt proj(pt r){return p+pq*((r-p)*pq/pq.norm2());}
  pt ref(pt r){return proj(r)*2-r;}
  double dist(pt r){return (r-proj(r)).norm();}
  // double dist(ln l){                            // only 3D
  //   if(*this/l)return dist(l.p);
  //   return abs((l.p-p)*(pq^l.pq))/(pq^l.pq).norm();
  // }
  ln rot(auto a){return ln(p,p+pq.rot(a));} // 2D
};

ln bisector(ln l, ln m){ // angle bisector
  pt p=l^m;
  return ln(p,p+l.pq.unit()+m.pq.unit());
}
ln bisector(pt p, pt q){ // segment bisector (2D)
  return ln((p+q)*.5,p).rot(ccw90);
}

// POLIGONO

int sgn(double x){return x<-EPS?-1:x>EPS;}

struct pol {
  int n;vector<pt> p;
  pol(){}
  pol(vector<pt> _p){p=_p;n=p.size();}
  double area(){
    double r=0.;
    for(int i = 0; i < n; i++)r+=p[i]%p[(i+1)%n];
    return abs(r)/2; // negative if CW, positive if CCW
  }
  pt centroid(){ // (barycenter)
    pt r(0,0);
    double t=0;
    for(int i = 0; i < n; i++){
      r=r+(p[i]+p[(i+1)%n])*(p[i]%p[(i+1)%n]);
      t+=p[i]%p[(i+1)%n];
    }
    return r/t/3;
  }
  bool has(pt q){ // O(n)
    for(int i = 0; i < n; i++)if(ln(p[i],p[(i+1)%n]).seghas(q))return true;
    int cnt=0;
    for(int i = 0; i < n; i++){
      int j=(i+1)%n;
      int k=sgn((q-p[j])%(p[i]-p[j]));
      int u=sgn(p[i].y-q.y),v=sgn(p[j].y-q.y);
      if(k>0&&u<0&&v>=0)cnt++;
      if(k<0&&v<0&&u>=0)cnt--;
    }
    return cnt!=0;
  }
  void normalize(){ // (call before haslog, remove collinear first)
    if(p[2].left(p[0],p[1]))reverse(p.begin(),p.end());
    int pi=min_element(p.begin(),p.end())-p.begin();
    vector<pt> s(n);
    for(int i = 0; i < n; i++)s[i]=p[(pi+i)%n];
    p.swap(s);
  }
  bool haslog(pt q){ // O(log(n)) only CONVEX. Call normalize first
    if(q.left(p[0],p[1])||q.left(p.back(),p[0]))return false;
    int a=1,b=p.size()-1; // returns true if point on boundary
    while(b-a>1){         // (change sign of EPS in left
      int c=(a+b)/2;      // to return false in such case)
      if(!q.left(p[0],p[c]))a=c;
      else b=c;
    }
    return !q.left(p[a],p[a+1]);
  }
  pol cut(ln l){ // cut CONVEX polygon by line l
    vector<pt> q; // returns part at left of l.pq
    for(int i = 0; i < n; i++){
      int d0=sgn(l.pq%(p[i]-l.p)),d1=sgn(l.pq%(p[(i+1)%n]-l.p));
      if(d0>=0)q.push_back(p[i]);
      ln m(p[i],p[(i+1)%n]);
      if(d0*d1<0&&!(l/m))q.push_back(l^m);
    }
    return pol(q);
  }
};

int main(){
  int t;
  cin >> t;
  while(t--){
    double a, b;
    cin >> a >> b;
    if(a == 0 && b == 0){
      cout << fixed << setprecision(10) << 1. << endl;
    }
    else{
      ln l(pt(0,0), pt(1, 1));
      pt x1(-b, 0), x2(-b, a/4), x3(b, a/4), x4(b, 0);
      vector <pt> v = {x1, x2, x3, x4};
      pol p(v);
      double tot = p.area();
      if(tot == 0){
        cout << 0 << endl;
      }
      else{
        cout << fixed << setprecision(10) << p.cut(l).area()/tot << endl;
      }
    }
  }
}


#include <bits/stdc++.h>
using namespace std;

const double EPS = 1e-10, DINF = 1e100;

// PUNTO

struct pt { // for 3D add z coordinate
  double x,y;
  pt(double x, double y):x(x),y(y){}
  pt(){}
  double norm2(){return *this**this;}
  double norm(){return sqrt(norm2());}
  bool operator==(pt p){return abs(x-p.x)<EPS&&abs(y-p.y)<EPS;}
  pt operator+(pt p){return pt(x+p.x,y+p.y);}
  pt operator-(pt p){return pt(x-p.x,y-p.y);}
  pt operator*(double t){return pt(x*t,y*t);}
  pt operator/(double t){return pt(x/t,y/t);}
  double operator*(pt p){return x*p.x+y*p.y;}
  // pt operator^(pt p){ // only for 3D
  //return pt(y*p.z-z*p.y,z*p.x-x*p.z,x*p.y-y*p.x);}
  double angle(pt p){ // redefine acos for values out of range
  return acos(*this*p/(norm()*p.norm()));}
  pt unit(){return *this/norm();}
  double operator%(pt p){return x*p.y-y*p.x;}
  // 2D from now on
  bool operator<(pt p)const{ // for convex hull
  return x<p.x-EPS||(abs(x-p.x)<EPS&&y<p.y-EPS);}
  bool left(pt p, pt q){ // is it to the left of directed line pq?
  return (q-p)%(*this-p)>EPS;}
  pt rot(pt r){return pt(*this%r,*this*r);}
  pt rot(double a){return rot(pt(sin(a),cos(a)));}
};
pt ccw90(1,0);
pt cw90(-1,0);

// LINEA

int sgn2(double x){return x<0?-1:1;}

struct ln {
  pt p,pq;
  ln(pt p, pt q):p(p),pq(q-p){}
  ln(){}
  bool has(pt r){return dist(r)<EPS;}
  bool seghas(pt r){return has(r)&&(r-p)*(r-(p+pq))-EPS<0;}
  // bool operator /(ln l){return (pq.unit()^l.pq.unit()).norm()<EPS;}  // 3D
  bool operator/(ln l){return abs(pq.unit()%l.pq.unit())<EPS;}          // 2D
  bool operator==(ln l){return *this/l&&has(l.p);}
  pt operator^(ln l){ // intersection
  if(*this/l)return pt(DINF,DINF);
  pt r=l.p+l.pq*((p-l.p)%pq/(l.pq%pq));
  //if(!has(r)){return pt(NAN,NAN,NAN);}           // check only for 3D
  return r;
  }
  double angle(ln l){return pq.angle(l.pq);}
  int side(pt r){return has(r)?0:sgn2(pq%(r-p));}  // 2D
  pt proj(pt r){return p+pq*((r-p)*pq/pq.norm2());}
  pt ref(pt r){return proj(r)*2-r;}
  double dist(pt r){return (r-proj(r)).norm();}
  // double dist(ln l){                            // only 3D
  //   if(*this/l)return dist(l.p);
  //   return abs((l.p-p)*(pq^l.pq))/(pq^l.pq).norm();
  // }
  ln rot(auto a){return ln(p,p+pq.rot(a));} // 2D
};

ln bisector(ln l, ln m){ // angle bisector
  pt p=l^m;
  return ln(p,p+l.pq.unit()+m.pq.unit());
}
ln bisector(pt p, pt q){ // segment bisector (2D)
  return ln((p+q)*.5,p).rot(ccw90);
}

// POLIGONO

int sgn(double x){return x<-EPS?-1:x>EPS;}

struct pol {
  int n;vector<pt> p;
  pol(){}
  pol(vector<pt> _p){p=_p;n=p.size();}
  double area(){
    double r=0.;
    for(int i = 0; i < n; i++)r+=p[i]%p[(i+1)%n];
    return abs(r)/2; // negative if CW, positive if CCW
  }
  pt centroid(){ // (barycenter)
    pt r(0,0);
    double t=0;
    for(int i = 0; i < n; i++){
      r=r+(p[i]+p[(i+1)%n])*(p[i]%p[(i+1)%n]);
      t+=p[i]%p[(i+1)%n];
    }
    return r/t/3;
  }
  bool has(pt q){ // O(n)
    for(int i = 0; i < n; i++)if(ln(p[i],p[(i+1)%n]).seghas(q))return true;
    int cnt=0;
    for(int i = 0; i < n; i++){
      int j=(i+1)%n;
      int k=sgn((q-p[j])%(p[i]-p[j]));
      int u=sgn(p[i].y-q.y),v=sgn(p[j].y-q.y);
      if(k>0&&u<0&&v>=0)cnt++;
      if(k<0&&v<0&&u>=0)cnt--;
    }
    return cnt!=0;
  }
  void normalize(){ // (call before haslog, remove collinear first)
    if(p[2].left(p[0],p[1]))reverse(p.begin(),p.end());
    int pi=min_element(p.begin(),p.end())-p.begin();
    vector<pt> s(n);
    for(int i = 0; i < n; i++)s[i]=p[(pi+i)%n];
    p.swap(s);
  }
  bool haslog(pt q){ // O(log(n)) only CONVEX. Call normalize first
    if(q.left(p[0],p[1])||q.left(p.back(),p[0]))return false;
    int a=1,b=p.size()-1; // returns true if point on boundary
    while(b-a>1){         // (change sign of EPS in left
      int c=(a+b)/2;      // to return false in such case)
      if(!q.left(p[0],p[c]))a=c;
      else b=c;
    }
    return !q.left(p[a],p[a+1]);
  }
  pol cut(ln l){ // cut CONVEX polygon by line l
    vector<pt> q; // returns part at left of l.pq
    for(int i = 0; i < n; i++){
      int d0=sgn(l.pq%(p[i]-l.p)),d1=sgn(l.pq%(p[(i+1)%n]-l.p));
      if(d0>=0)q.push_back(p[i]);
      ln m(p[i],p[(i+1)%n]);
      if(d0*d1<0&&!(l/m))q.push_back(l^m);
    }
    return pol(q);
  }
};

int main(){
  int t;
  cin >> t;
  while(t--){
    double a, b;
    cin >> a >> b;
    if(b == 0){
      cout << fixed << setprecision(10) << 1. << endl;
    }
    else if(a == 0){
      cout << fixed << setprecision(10) << 0.5 << endl;
    }
    else{
      ln l(pt(0,0), pt(1, 1));
      pt x1(-b, 0), x2(-b, a/4), x3(b, a/4), x4(b, 0);
      vector <pt> v = {x1, x2, x3, x4};
      pol p(v);
      double tot = p.area();
      if(tot == 0){
      cout << fixed << setprecision(10) << 0. << endl;
      }
      else{
        cout << fixed << setprecision(10) << p.cut(l).area()/tot << endl;
      }
    }
  }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
  int t;
  cin >> t;
  cout << fixed << setprecision(10);
  while(t--){
    double a, b;
    cin >> a >> b;
    a /= 4;
    if(a == 0 || b == 0){
      cout << 1.-0.5*(a==0 && b) << endl;
    }
    else if(a >= b){
      cout << 1 - b/(4*a) << endl;
    }
    else{
      cout << (a+2*b)/(4*b) << endl;
    }
  }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
  int t;
  cin >> t;
  cout << fixed << setprecision(10);
  while(t--){
    double a, b;
    cin >> a >> b;
    a /= 4;
    if(a == 0 || b == 0){
      cout << 1.-0.5*(a==0 && b) << endl;
    }
    else if(a >= b){
      cout << 1 - b/(4*a) << endl;
    }
    else{
      cout << 0.5 + a/(4*b) << endl;
    }
  }
}


#include <bits/stdc++.h>
using namespace std;

const double EPS = 1e-10, DINF = 1e100;

// PUNTO

struct pt { // for 3D add z coordinate
  double x,y;
  pt(double x, double y):x(x),y(y){}
  pt(){}
  double norm2(){return *this**this;}
  double norm(){return sqrt(norm2());}
  bool operator==(pt p){return abs(x-p.x)<EPS&&abs(y-p.y)<EPS;}
  pt operator+(pt p){return pt(x+p.x,y+p.y);}
  pt operator-(pt p){return pt(x-p.x,y-p.y);}
  pt operator*(double t){return pt(x*t,y*t);}
  pt operator/(double t){return pt(x/t,y/t);}
  double operator*(pt p){return x*p.x+y*p.y;}
  // pt operator^(pt p){ // only for 3D
  //return pt(y*p.z-z*p.y,z*p.x-x*p.z,x*p.y-y*p.x);}
  double angle(pt p){ // redefine acos for values out of range
  return acos(*this*p/(norm()*p.norm()));}
  pt unit(){return *this/norm();}
  double operator%(pt p){return x*p.y-y*p.x;}
  // 2D from now on
  bool operator<(pt p)const{ // for convex hull
  return x<p.x-EPS||(abs(x-p.x)<EPS&&y<p.y-EPS);}
  bool left(pt p, pt q){ // is it to the left of directed line pq?
  return (q-p)%(*this-p)>EPS;}
  pt rot(pt r){return pt(*this%r,*this*r);}
  pt rot(double a){return rot(pt(sin(a),cos(a)));}
};
pt ccw90(1,0);
pt cw90(-1,0);

// LINEA

int sgn2(double x){return x<0?-1:1;}

struct ln {
  pt p,pq;
  ln(pt p, pt q):p(p),pq(q-p){}
  ln(){}
  bool has(pt r){return dist(r)<EPS;}
  bool seghas(pt r){return has(r)&&(r-p)*(r-(p+pq))-EPS<0;}
  // bool operator /(ln l){return (pq.unit()^l.pq.unit()).norm()<EPS;}  // 3D
  bool operator/(ln l){return abs(pq.unit()%l.pq.unit())<EPS;}          // 2D
  bool operator==(ln l){return *this/l&&has(l.p);}
  pt operator^(ln l){ // intersection
  if(*this/l)return pt(DINF,DINF);
  pt r=l.p+l.pq*((p-l.p)%pq/(l.pq%pq));
  //if(!has(r)){return pt(NAN,NAN,NAN);}           // check only for 3D
  return r;
  }
  double angle(ln l){return pq.angle(l.pq);}
  int side(pt r){return has(r)?0:sgn2(pq%(r-p));}  // 2D
  pt proj(pt r){return p+pq*((r-p)*pq/pq.norm2());}
  pt ref(pt r){return proj(r)*2-r;}
  double dist(pt r){return (r-proj(r)).norm();}
  // double dist(ln l){                            // only 3D
  //   if(*this/l)return dist(l.p);
  //   return abs((l.p-p)*(pq^l.pq))/(pq^l.pq).norm();
  // }
  ln rot(auto a){return ln(p,p+pq.rot(a));} // 2D
};

ln bisector(ln l, ln m){ // angle bisector
  pt p=l^m;
  return ln(p,p+l.pq.unit()+m.pq.unit());
}
ln bisector(pt p, pt q){ // segment bisector (2D)
  return ln((p+q)*.5,p).rot(ccw90);
}

// POLIGONO

int sgn(double x){return x<-EPS?-1:x>EPS;}

struct pol {
  int n;vector<pt> p;
  pol(){}
  pol(vector<pt> _p){p=_p;n=p.size();}
  double area(){
    double r=0.;
    for(int i = 0; i < n; i++)r+=p[i]%p[(i+1)%n];
    return abs(r)/2; // negative if CW, positive if CCW
  }
  pt centroid(){ // (barycenter)
    pt r(0,0);
    double t=0;
    for(int i = 0; i < n; i++){
      r=r+(p[i]+p[(i+1)%n])*(p[i]%p[(i+1)%n]);
      t+=p[i]%p[(i+1)%n];
    }
    return r/t/3;
  }
  bool has(pt q){ // O(n)
    for(int i = 0; i < n; i++)if(ln(p[i],p[(i+1)%n]).seghas(q))return true;
    int cnt=0;
    for(int i = 0; i < n; i++){
      int j=(i+1)%n;
      int k=sgn((q-p[j])%(p[i]-p[j]));
      int u=sgn(p[i].y-q.y),v=sgn(p[j].y-q.y);
      if(k>0&&u<0&&v>=0)cnt++;
      if(k<0&&v<0&&u>=0)cnt--;
    }
    return cnt!=0;
  }
  void normalize(){ // (call before haslog, remove collinear first)
    if(p[2].left(p[0],p[1]))reverse(p.begin(),p.end());
    int pi=min_element(p.begin(),p.end())-p.begin();
    vector<pt> s(n);
    for(int i = 0; i < n; i++)s[i]=p[(pi+i)%n];
    p.swap(s);
  }
  bool haslog(pt q){ // O(log(n)) only CONVEX. Call normalize first
    if(q.left(p[0],p[1])||q.left(p.back(),p[0]))return false;
    int a=1,b=p.size()-1; // returns true if point on boundary
    while(b-a>1){         // (change sign of EPS in left
      int c=(a+b)/2;      // to return false in such case)
      if(!q.left(p[0],p[c]))a=c;
      else b=c;
    }
    return !q.left(p[a],p[a+1]);
  }
  pol cut(ln l){ // cut CONVEX polygon by line l
    vector<pt> q; // returns part at left of l.pq
    for(int i = 0; i < n; i++){
      int d0=sgn(l.pq%(p[i]-l.p)),d1=sgn(l.pq%(p[(i+1)%n]-l.p));
      if(d0>=0)q.push_back(p[i]);
      ln m(p[i],p[(i+1)%n]);
      if(d0*d1<0&&!(l/m))q.push_back(l^m);
    }
    return pol(q);
  }
};

int main(){
  int t;
  cin >> t;
  while(t--){
    double a, b;
    cin >> a >> b;
    ln l(pt(0,0), pt(1, 1));
    pt x1(-b, 0), x2(-b, a/4), x3(b, a/4), x4(b, 0);
    vector <pt> v = {x1, x2, x3, x4};
    pol p(v);
    double tot = p.area();
    if(tot == 0){
      cout << 0 << endl;
    }
    else{
      cout << fixed << setprecision(10) << p.cut(l).area()/tot << endl;
    }
  }
}


#include <bits/stdc++.h>
using namespace std;

const double EPS = 1e-10, DINF = 1e100;

// PUNTO

struct pt { // for 3D add z coordinate
  double x,y;
  pt(double x, double y):x(x),y(y){}
  pt(){}
  double norm2(){return *this**this;}
  double norm(){return sqrt(norm2());}
  bool operator==(pt p){return abs(x-p.x)<EPS&&abs(y-p.y)<EPS;}
  pt operator+(pt p){return pt(x+p.x,y+p.y);}
  pt operator-(pt p){return pt(x-p.x,y-p.y);}
  pt operator*(double t){return pt(x*t,y*t);}
  pt operator/(double t){return pt(x/t,y/t);}
  double operator*(pt p){return x*p.x+y*p.y;}
  // pt operator^(pt p){ // only for 3D
  //return pt(y*p.z-z*p.y,z*p.x-x*p.z,x*p.y-y*p.x);}
  double angle(pt p){ // redefine acos for values out of range
  return acos(*this*p/(norm()*p.norm()));}
  pt unit(){return *this/norm();}
  double operator%(pt p){return x*p.y-y*p.x;}
  // 2D from now on
  bool operator<(pt p)const{ // for convex hull
  return x<p.x-EPS||(abs(x-p.x)<EPS&&y<p.y-EPS);}
  bool left(pt p, pt q){ // is it to the left of directed line pq?
  return (q-p)%(*this-p)>EPS;}
  pt rot(pt r){return pt(*this%r,*this*r);}
  pt rot(double a){return rot(pt(sin(a),cos(a)));}
};
pt ccw90(1,0);
pt cw90(-1,0);

// LINEA

int sgn2(double x){return x<0?-1:1;}

struct ln {
  pt p,pq;
  ln(pt p, pt q):p(p),pq(q-p){}
  ln(){}
  bool has(pt r){return dist(r)<EPS;}
  bool seghas(pt r){return has(r)&&(r-p)*(r-(p+pq))-EPS<0;}
  // bool operator /(ln l){return (pq.unit()^l.pq.unit()).norm()<EPS;}  // 3D
  bool operator/(ln l){return abs(pq.unit()%l.pq.unit())<EPS;}          // 2D
  bool operator==(ln l){return *this/l&&has(l.p);}
  pt operator^(ln l){ // intersection
  if(*this/l)return pt(DINF,DINF);
  pt r=l.p+l.pq*((p-l.p)%pq/(l.pq%pq));
  //if(!has(r)){return pt(NAN,NAN,NAN);}           // check only for 3D
  return r;
  }
  double angle(ln l){return pq.angle(l.pq);}
  int side(pt r){return has(r)?0:sgn2(pq%(r-p));}  // 2D
  pt proj(pt r){return p+pq*((r-p)*pq/pq.norm2());}
  pt ref(pt r){return proj(r)*2-r;}
  double dist(pt r){return (r-proj(r)).norm();}
  // double dist(ln l){                            // only 3D
  //   if(*this/l)return dist(l.p);
  //   return abs((l.p-p)*(pq^l.pq))/(pq^l.pq).norm();
  // }
  ln rot(auto a){return ln(p,p+pq.rot(a));} // 2D
};

ln bisector(ln l, ln m){ // angle bisector
  pt p=l^m;
  return ln(p,p+l.pq.unit()+m.pq.unit());
}
ln bisector(pt p, pt q){ // segment bisector (2D)
  return ln((p+q)*.5,p).rot(ccw90);
}

// POLIGONO

int sgn(double x){return x<-EPS?-1:x>EPS;}

struct pol {
  int n;vector<pt> p;
  pol(){}
  pol(vector<pt> _p){p=_p;n=p.size();}
  double area(){
    double r=0.;
    for(int i = 0; i < n; i++)r+=p[i]%p[(i+1)%n];
    return abs(r)/2; // negative if CW, positive if CCW
  }
  pt centroid(){ // (barycenter)
    pt r(0,0);
    double t=0;
    for(int i = 0; i < n; i++){
      r=r+(p[i]+p[(i+1)%n])*(p[i]%p[(i+1)%n]);
      t+=p[i]%p[(i+1)%n];
    }
    return r/t/3;
  }
  bool has(pt q){ // O(n)
    for(int i = 0; i < n; i++)if(ln(p[i],p[(i+1)%n]).seghas(q))return true;
    int cnt=0;
    for(int i = 0; i < n; i++){
      int j=(i+1)%n;
      int k=sgn((q-p[j])%(p[i]-p[j]));
      int u=sgn(p[i].y-q.y),v=sgn(p[j].y-q.y);
      if(k>0&&u<0&&v>=0)cnt++;
      if(k<0&&v<0&&u>=0)cnt--;
    }
    return cnt!=0;
  }
  void normalize(){ // (call before haslog, remove collinear first)
    if(p[2].left(p[0],p[1]))reverse(p.begin(),p.end());
    int pi=min_element(p.begin(),p.end())-p.begin();
    vector<pt> s(n);
    for(int i = 0; i < n; i++)s[i]=p[(pi+i)%n];
    p.swap(s);
  }
  bool haslog(pt q){ // O(log(n)) only CONVEX. Call normalize first
    if(q.left(p[0],p[1])||q.left(p.back(),p[0]))return false;
    int a=1,b=p.size()-1; // returns true if point on boundary
    while(b-a>1){         // (change sign of EPS in left
      int c=(a+b)/2;      // to return false in such case)
      if(!q.left(p[0],p[c]))a=c;
      else b=c;
    }
    return !q.left(p[a],p[a+1]);
  }
  pol cut(ln l){ // cut CONVEX polygon by line l
    vector<pt> q; // returns part at left of l.pq
    for(int i = 0; i < n; i++){
      int d0=sgn(l.pq%(p[i]-l.p)),d1=sgn(l.pq%(p[(i+1)%n]-l.p));
      if(d0>=0)q.push_back(p[i]);
      ln m(p[i],p[(i+1)%n]);
      if(d0*d1<0&&!(l/m))q.push_back(l^m);
    }
    return pol(q);
  }
};

int main(){
  int t;
  cin >> t;
  while(t--){
    double a, b;
    cin >> a >> b;
    if(a == 0 || b == 0){
      cout << fixed << setprecision(10) << 1. << endl;
    }
    else{
      ln l(pt(0,0), pt(1, 1));
      pt x1(-b, 0), x2(-b, a/4), x3(b, a/4), x4(b, 0);
      vector <pt> v = {x1, x2, x3, x4};
      pol p(v);
      double tot = p.area();
      if(tot == 0){
      cout << fixed << setprecision(10) << 0. << endl;
      }
      else{
        cout << fixed << setprecision(10) << p.cut(l).area()/tot << endl;
      }
    }
  }
}


// g++ -std=c++14

#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define inf 1000000000000000001

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

int main(){
  int t;
  cin>>t;
  while(t--){
    lld a,b,temp;
    cin>>a>>b;
    if(b==0){
      printf("1.0000000\n");
      return 0;
    }
    if(a==0){
      printf("0.50000000\n");
      return 0;
    }
    if(4*b<a){
      lld ans = ((a -b)/a);
      printf("%0.6Lf\n",ans);
    }
    else{
      lld ans = ((b + a/8)/(2*b));
      printf("%0.6Lf\n",ans);
    }
  }
  return 0;
}


// g++ -std=c++14

#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define inf 1000000000000000001

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

int main(){
  int t;
  cin>>t;
  while(t--){
    lld a,b,temp;
    cin>>a>>b;
    if(b==0){
      printf("1.0000000\n");
      continue;
    }
    if(a==0){
      printf("0.50000000\n");
      continue;
    }
    if(4*b<a){
      lld ans = ((a -b)/a);
      printf("%0.9Lf\n",ans);
    }
    else{
      lld ans = ((b + a/8)/(2*b));
      printf("%0.9Lf\n",ans);
    }
  }
  return 0;
}


// g++ -std=c++14

#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define inf 1000000000000000001

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

int main(){
  int t;
  cin>>t;
  while(t--){
    lld a,b,temp;
    cin>>a>>b;
    if(b==0){
      printf("1.0000000\n");
      return 0;
    }
    if(a==0){
      printf("0.50000000\n");
      return 0;
    }
    if(4*b<a){
      lld ans = ((a -b)/a);
      printf("%0.9Lf\n",ans);
    }
    else{
      lld ans = ((b + a/8)/(2*b));
      printf("%0.9Lf\n",ans);
    }
  }
  return 0;
}


// g++ -std=c++14

#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define inf 1000000000000000001

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

int main(){
  int t;
  cin>>t;
  while(t--){
    lld a,b,temp;
    cin>>a>>b;
    if(b==0){
      cout<<1<<endl;
      return 0;
    }
    if(a==0){
      printf("0.5\n");
      return 0;
    }
    if(4*b<a){
      lld ans = ((a -b)/a);
      printf("%0.6Lf\n",ans);
    }
    else{
      lld ans = ((b + a/8)/(2*b));
      printf("%0.6Lf\n",ans);
    }
  }
  return 0;
}


/*
    NO
        TIME
            TO
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;

 	while (res >= mod) res -= mod;

 	while (res < 0) res += mod;

 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
int main()
{
 IO;
 OS;
 lli q;
 cin>>q;
 cout<<setprecision(15)<<"\0";
 for(int i=1;i<=q;i++)
 {
     double a,b;
     cin>>a>>b;
     if(a<=4*b&&b>0)
     {
     double cc=a/(16.0*b) + 0.5;
     cout<<cc<<"\n";
     }
     else if(a>0&&b>0)
     {
         double cc=a-b;
         cc/=a;
         cout<<cc<<"\n";
     }
     else if(a==0&&b>0)
     {
         double cc=0.5;
         cout<<cc<<"\n";
     }
     else if(a>0&&b==0)
     cout<<1<<"\n";
     else
     cout<<0<<"\n";
 }
}


/*
    U FAIL U IMPROVE
                    U SKIP U LOSE!!
                                    */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1e9+7;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,x,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
int main()
{
    ios_base::sync_with_stdio(0);
    lli t;
    cout<<setprecision(16)<<"\0";
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        double a,b;
        cin>>a>>b;
        double y;
        if(a>0&&b>0)
        {
        if(4.0*b>a)
        y=(a+8.0*b)/(16.0*b);
        else
        y=(a-b)/a;
        }
        else if(b>0)
        y=(a+8.0*b)/(16.0*b);
        else if(a>0)
        y=(a-b)/a;
        else
        y=1;
        cout<<y<<"\n";
    }
}


/*
    NO
        TIME
            TO
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;

 	while (res >= mod) res -= mod;

 	while (res < 0) res += mod;

 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
int main()
{
 IO;
 OS;
 lli q;
 cin>>q;
 cout<<setprecision(15)<<"\0";
 for(int i=1;i<=q;i++)
 {
     double a,b;
     cin>>a>>b;
     if(a<=4*b)
     {
     double cc=a/(16.0*b) + 0.5;
     cout<<cc<<"\n";
     }
     else
     {
         double cc=a-b;
         cc/=a;
         cout<<cc<<"\n";
     }
 }
}


/*
    NO
        TIME
            TO
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;

 	while (res >= mod) res -= mod;

 	while (res < 0) res += mod;

 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
int main()
{
 IO;
 OS;
 lli q;
 cin>>q;
 cout<<setprecision(15)<<"\0";
 for(int i=1;i<=q;i++)
 {
     double a,b;
     cin>>a>>b;
     if(a<=4*b&&b>0)
     {
     double cc=a/(16.0*b) + 0.5;
     cout<<cc<<"\n";
     }
     else if(a>0&&b>0)
     {
         double cc=a-b;
         cc/=a;
         cout<<cc<<"\n";
     }
     else if(a==0&&b>0)
     {
         double cc=0.5;
         cout<<cc<<"\n";
     }
     else
     cout<<0<<"\n";
 }
}


/*
    NO
        TIME
            TO
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;

 	while (res >= mod) res -= mod;

 	while (res < 0) res += mod;

 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
int main()
{
 IO;
 OS;
 lli q;
 cin>>q;
 cout<<setprecision(15)<<"\0";
 for(int i=1;i<=q;i++)
 {
     double a,b;
     cin>>a>>b;
     double cc=a/(16.0*b) + 0.5;
     cout<<cc<<"\n";
 }
}


/*
    U FAIL U IMPROVE
                    U SKIP U LOSE!!
                                    */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1e9+7;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,x,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
int main()
{
    ios_base::sync_with_stdio(0);
    lli t;
    cout<<setprecision(16)<<"\0";
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        double a,b;
        cin>>a>>b;
        double y;
        if(4.0*b>a)
        y=(a+8.0*b)/(16.0*b);
        else
        y=(a-b)/b;
        cout<<y<<"\n";
    }
}


/*
    NO
        TIME
            TO
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;

 	while (res >= mod) res -= mod;

 	while (res < 0) res += mod;

 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
int main()
{
 IO;
 OS;
 lli q;
 cin>>q;
 cout<<setprecision(15)<<"\0";
 for(int i=1;i<=q;i++)
 {
     double a,b;
     cin>>a>>b;
     if(a<=4*b&&b>0)
     {
     double cc=a/(16.0*b) + 0.5;
     cout<<cc<<"\n";
     }
     else if(a>0&&b>0)
     {
         double cc=a-b;
         cc/=a;
         cout<<cc<<"\n";
     }
     else if(a==0&&b>0)
     {
         double cc=0.5;
         cout<<cc<<"\n";
     }
     else
     cout<<1<<"\n";
 }
}


/*
    U FAIL U IMPROVE
                    U SKIP U LOSE!!
                                    */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1e9+7;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,x,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
int main()
{
    ios_base::sync_with_stdio(0);
    lli t;
    cout<<setprecision(16)<<"\0";
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        double a,b;
        cin>>a>>b;
        double y=0.5+(a/b)*(1.0/16.0);
        cout<<y<<"\n";
    }
}


/*
    U FAIL U IMPROVE
                    U SKIP U LOSE!!
                                    */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1e9+7;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,x,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
int main()
{
    ios_base::sync_with_stdio(0);
    lli t;
    cout<<setprecision(16)<<"\0";
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        double a,b;
        cin>>a>>b;
        double y;
        if(4.0*b>a)
        y=(a+8.0*b)/(16.0*b);
        else
        y=(a-b)/a;
        cout<<y<<"\n";
    }
}


/*input
3 5
0 2
2 4
3 5
*/
#include <iostream>
using namespace std;

int main()
{
	int i,n,m, a, b, c[107], d;
	cin>>n>>m;
	for (i = 0; i < n; i++)
	{
		cin>>a>>b;
		for (int j = a+1; j <= b; j++)
		{
			c[j]=1;
		}
	}
	for (i = 1; i <= m; i++)
	{
		if (c[i])
		{
			d = 1;
		}
		else
		{
			d = 0;
			break;
		}
	}
	if (d)
	{
		cout<<"YES\n";
	}
	else
		cout<<"NO\n";
	return 0;
}


/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define endl "\n"
#define inf 1<<30
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ss stringstream
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define bit_cnt(mask) __builtin_popcount(mask)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1000000007; /// 1e9+7
const int MAX = 100005;     /// 1e5+5
ll bigmod(ll n, ll r)
{
    if(r==0) return 1;
    if(r==1) return n;
    if(r%2==0)
    {
        ll ret = bigmod(n, r/2);
        return ((ret%MOD) * (ret%MOD)) % MOD;
    }
    else return ((n%MOD) * (bigmod(n,r-1)%MOD)) % MOD;
}
ll modinverse(ll a){return bigmod(a,MOD-2)%MOD;}
ll lcm(ll a, ll b) {a=abs(a); b=abs(b); return (a/__gcd(a,b))*b;}
ll gcd(ll a, ll b) {a=abs(a); b=abs(b); if(!b) return a; return __gcd(b,a%b);}
int in() {int x; scanf("%d",&x); return x;}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n;
    int m; cin>>m;
    int a, b; cin>>a>>b;
    if(m>=a and m<=b) cout<<"YES"<<endl, exit(0);
    if(m<a) cout<<"NO"<<endl, exit(0);
    int mx=b; n--;
    while(n--){
        int a, b; cin>>a>>b;
        if(a>mx){
            cout<<"NO"<<endl, exit(0);
        }
        else{
            mx =max(mx, b);
            if(m<=b) cout<<"YES"<<endl, exit(0);
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define endl "\n"
#define inf 1<<30
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ss stringstream
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define bit_cnt(mask) __builtin_popcount(mask)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1000000007; /// 1e9+7
const int MAX = 100005;     /// 1e5+5
ll bigmod(ll n, ll r)
{
    if(r==0) return 1;
    if(r==1) return n;
    if(r%2==0)
    {
        ll ret = bigmod(n, r/2);
        return ((ret%MOD) * (ret%MOD)) % MOD;
    }
    else return ((n%MOD) * (bigmod(n,r-1)%MOD)) % MOD;
}
ll modinverse(ll a){return bigmod(a,MOD-2)%MOD;}
ll lcm(ll a, ll b) {a=abs(a); b=abs(b); return (a/__gcd(a,b))*b;}
ll gcd(ll a, ll b) {a=abs(a); b=abs(b); if(!b) return a; return __gcd(b,a%b);}
int in() {int x; scanf("%d",&x); return x;}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n;
    int m; cin>>m;
    int a, b; cin>>a>>b;
    if(m>=a and m<=b) cout<<"YES"<<endl, exit(0);
    if(a!=0) cout<<"NO"<<endl, exit(0);
    int mx=b; n--;
    while(n--){
        int a, b; cin>>a>>b;
        if(a>mx){
            cout<<"NO"<<endl, exit(0);
        }
        else{
            mx=max(mx, b);
            if(m<=b) cout<<"YES"<<endl, exit(0);
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x , y , sizeof(x))
using namespace std;
typedef long long ll;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const ll MOD = 1000000007;
const int MAX = 100005;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
	return 0;
}