#include <bits/stdc++.h>
const double INF = 1e30;
int a, b;
double calc(int x, int y) {
  if (x < 0 || x < 2 * y) {
    return INF;
  } else if (x == 0) {
    return 1.0 * y;
  }
  int k = x / (2 * y);
  return 1.0 * x / k / 2;
}
bool work() {
  double ret = std::min(calc(a - b, b), calc(a + b, b));
  if (ret > 1e20) {
    return false;
  }
  printf("%.12f\n", ret);
  return true;
}
int main() {
  scanf("%d%d", &a, &b);
  if (!work()) {
    puts("-1");
  }
  return 0;
}
