#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 300005, maxm = 305;
const double eps = 1e-9;
const double pi = acos(-1.0);
int main() {
  int i, j;
  int a, b;
  scanf("%d %d", &a, &b);
  if (a == b) {
    printf("%d\n", b);
  } else if (a < b) {
    printf("-1\n");
  } else {
    double r = 1e18;
    int kk = a / b;
    if (kk % 2 == 0) --kk;
    int k1 = (kk - 1) / 2;
    r = min(r, (a - b) / (2.0 * k1));
    int k2 = (kk + 1) / 2;
    r = min(r, (a + b) / (2.0 * k2));
    printf("%.10lf\n", r);
  }
  return 0;
}
