#include <bits/stdc++.h>
using namespace std;
double qmin = 0x7fffffff;
int main(void) {
  long long a, b;
  cin >> a >> b;
  if (a < b) {
    puts("-1");
    return 0;
  }
  {
    int x = a + b;
    int now = ceil(x / b / 2);
    while (x / double(now) / 2.0 < b) now--;
    qmin = min(qmin, x / double(now) / 2.0);
  }
  {
    int x = a - b;
    int now = ceil(x / b / 2);
    while (x / double(now) / 2.0 < b) now--;
    qmin = min(qmin, x / double(now) / 2.0);
  }
  printf("%.12lf\n", qmin);
  return 0;
}
