#include <bits/stdc++.h>
using namespace std;
int a, b;
double ans = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  if (b > a) {
    cout << "-1\n";
    return 0;
  }
  int l = 1, r = a, m = -1;
  while (l <= r) {
    int k = (l + r) / 2;
    double x = (a - b) / (2.0 * k);
    if (x < b) {
      r = k - 1;
    } else {
      m = k;
      l = k + 1;
    }
  }
  if (m != -1) {
    ans = min(ans, (a - b) / (2.0 * m));
  }
  l = 0, r = a, m = -1;
  while (l <= r) {
    int k = (l + r) / 2;
    double x = (a + b) / (2 * k + 2.0);
    if (x < b) {
      r = k - 1;
    } else {
      m = k;
      l = k + 1;
    }
  }
  if (m != -1) {
    ans = min(ans, (a + b) / (2.0 * m + 2.0));
  }
  printf("%.12f\n", ans);
  return 0;
}
