#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e6 + 7;
const int INF = (int)1e9 + 7;
map<long long, int> c[MAXN];
int n, k, x;
int a[MAXN];
long long pref[MAXN];
long long suff[MAXN];
int main() {
  int x, y;
  cin >> x >> y;
  if (y > x)
    cout << -1;
  else {
    double ans = INF;
    int fx = x - y;
    int lp = 0;
    int pieces = floor(double(fx) / double(y + y));
    if (pieces) ans = min(ans, double(fx) / double(pieces) / 2.0);
    fx = x + y;
    pieces = floor(double(fx) / double(y + y));
    if (pieces) ans = min(ans, double(fx) / double(pieces) / 2.0);
    cout << fixed << setprecision(10) << ans;
  }
  return 0;
}
