#include <bits/stdc++.h>
using namespace std;
long long x, y, ans1, ans2, x1, x2;
int main(int argc, char *argv[]) {
  cin >> x >> y;
  if (y > x)
    cout << "-1" << endl;
  else {
    x1 = x - y;
    ans1 = x1 / (y * 2);
    ans1 *= 2;
    x2 = x + y;
    ans2 = x2 / (y * 2);
    ans2 *= 2;
    if (x1 * ans2 < x2 * ans1) {
      printf("%.10f\n", x1 * 1.0 / ans1);
    } else {
      printf("%.10f\n", x2 * 1.0 / ans2);
    }
  }
  return 0;
}
