#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a < b)
    printf("-1");
  else {
    double ans;
    int xx = (a - b) / (2 * b);
    int yy = (a + b) / (2 * b);
    double xxx = ((a - b) * 1.0) / (2.0);
    double yyy = ((a + b) * 1.0) / (2.0);
    if (xxx < 0.000000001)
      ans = yyy;
    else if (yyy < 0.000000001)
      ans = xx;
    else
      ans = min(xxx / (xx * 1.0), (yyy / (yy * 1.0)));
    printf("%.12lf", ans);
  }
}
