#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int temp = b;
  double x, ans = 10000000001, d = 2;
  if (b > a) {
    cout << "-1" << endl;
    return 0;
  }
  d = (a + b) / b;
  d = (int)d;
  if ((int)d % 2 != 0) d = d - 1;
  x = (a + b) / (d);
  if (x >= temp && x > 0) {
    if (ans > x) ans = x;
  }
  d = (a - b) / b;
  d = (int)d;
  if ((int)d % 2 != 0) d = d - 1.0;
  x = (a - b) / d;
  if (x >= temp && x > 0) {
    if (ans > x) ans = x;
  }
  if (ans == 10000000001)
    cout << "-1" << endl;
  else {
    cout << fixed;
    cout << setprecision(12) << ans << endl;
  }
  return 0;
}
