#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, temp;
  double ans;
  scanf("%d%d", &x, &y);
  if (x == y) {
    printf("%d\n", x);
  } else if (y > x) {
    printf("%d\n", -1);
  } else {
    temp = x / y;
    if ((temp & 1) == 0) temp--;
    ans = y + (1.0 * x - temp * 1.0 * y) / (temp + 1);
    temp = x - y;
    if (temp >= y * 2) {
      temp = temp / (2 * y);
      ans = min(ans, ((x - y) * 1.0) / temp);
    }
    printf("%.15lf\n", ans);
  }
  return 0;
}
