#include <bits/stdc++.h>
using namespace std;
long double ans(int p, int q) {
  long double a = (long double)p;
  long double b = (long double)q;
  if (a < b) {
    return -1;
  }
  if (p == q) {
    return b;
  }
  long double x = 1e10;
  if (a > b) {
    long double j = floor(((a / (2 * b)) - 0.5));
    x = (a - b) / (2 * j);
  }
  long double i = floor(a / (2 * b) + 0.5);
  long double y = (a + b) / (2 * i);
  return min(x, y);
}
int main() {
  int a, b;
  cin >> a >> b;
  long double x = ans(a, b);
  if (a < b) {
    cout << -1 << endl;
  } else {
    cout << setprecision(15) << fixed << x << endl;
  }
}
