#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
void fmain() {
  int a, b;
  cin >> a >> b;
  if (a < b)
    puts("-1");
  else if (a == b)
    printf("%d\n", a);
  else {
    int c = (a + b) / b;
    if (c & 1) c--;
    double ans = (double)(a + b) / c;
    c = (a - b) / b;
    if (c & 1) c--;
    if (c > 0) ans = min(ans, (double)(a - b) / c);
    printf("%.10lf\n", ans);
  }
}
int main() {
  fmain();
  return 0;
}
