#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "-1\n";
    return 0;
  }
  if (a == b) {
    cout << b << "\n";
    return 0;
  }
  long long int k1 = -1, k2 = -1;
  k1 = (a - b) / (2 * b);
  k2 = (a + b) / (2 * b);
  double x;
  if (k1 == 0 and k2 == 0) {
    x = -1;
  } else if (k1 == 0) {
    x = (a + b) / (2.0 * k2);
  } else if (k2 == 0) {
    x = (a - b) / (2.0 * k1);
  } else {
    x = min((a + b) / (2.0 * k2), (a - b) / (2.0 * k1));
  }
  printf("%0.9lf\n", x);
  return 0;
}
