#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b;
  cin >> a >> b;
  if (b > a) {
    cout << -1;
  } else {
    if (a == b) {
      printf("%.12lf", b);
      return 0;
    }
    double x = a + b;
    double k;
    for (int i = int(x) / (b + 1);; i--) {
      if (x / (2 * i) >= b) {
        k = double(x) / (2 * (i));
        break;
      }
    }
    x = a - b;
    for (int i = int(x) / (b + 1);; i--) {
      if (x / (2 * i) >= b) {
        k = min(x / (2 * (i)), k);
        break;
      }
    }
    printf("%.12lf", k);
  }
}
