#include <bits/stdc++.h>
using namespace std;
int A, B;
double eps = 1e-9;
int main() {
  double ans = -1;
  scanf("%d%d", &A, &B);
  if (A < B) {
    printf("-1\n");
    return 0;
  }
  double k = 1.0 * (A - B) / (2.0 * B);
  if ((int)(k + eps) == 0)
    ans = 1e100;
  else
    ans = 1.0 * (A - B) / (2.0 * (int)(k + eps));
  k = 1.0 * (A + B) / (2.0 * B);
  ans = min(ans, 1.0 * (A + B) / (2.0 * (int)(k + eps)));
  printf("%.10f\n", ans);
}
