#include <bits/stdc++.h>
using namespace std;
bool ok(double a, double b) {
  if (a - b >= 0)
    return true;
  else
    return false;
}
double a, b;
double calc(double x) {
  int l = 1;
  int r = 1000000000;
  while (l < r) {
    int m = (l + r) / 2 + 1;
    if (ok(x / ((double)m * 2.0), b))
      l = m;
    else
      r = m - 1;
  }
  return l;
}
int main() {
  int aa, bb;
  cin >> aa >> bb;
  if (aa == bb) {
    cout << aa << endl;
    return 0;
  }
  if (aa < bb) {
    cout << -1 << endl;
    return 0;
  }
  a = aa;
  b = bb;
  double ans;
  double ans0 = (a - b) / (calc(a - b) * 2.0);
  double ans1 = (a + b) / (calc(a + b) * 2.0);
  if (ans0 < b)
    ans = ans1;
  else
    ans = min(ans0, ans1);
  printf("%.10lf\n", ans);
  return 0;
}
