#include <bits/stdc++.h>
using namespace std;
long long a, b;
double solve(long long len) {
  long long l = 1, r = 1000000000LL;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (len >= b * 2 * mid)
      l = mid;
    else
      r = mid - 1;
  }
  while (len < b * 2 * r) r--;
  return (double)len / r / 2.0;
}
int main() {
  scanf("%I64d%I64d", &a, &b);
  if (b > a || b == 0)
    printf("-1\n");
  else if (a == b) {
    printf("%I64d\n", a);
  } else {
    double ans1 = solve(a - b);
    double ans2 = solve(a + b);
    printf("%.10f\n", ((ans1) < (ans2) ? (ans1) : (ans2)));
  }
  return 0;
}
