#include <bits/stdc++.h>
using namespace std;
int A, B;
int main() {
  cin >> A >> B;
  double X1, X2;
  if (A < B) {
    cout << "-1\n";
    return 0;
  }
  double aux = (double)(A + B) / (double)B;
  int x = (int)floor(aux);
  if (x % 2 == 1) --x;
  X1 = (double)(A + B) / (double)x;
  aux = (double)(A - B) / (double)B;
  x = (int)floor(aux);
  if (x % 2 == 1) --x;
  X2 = (double)(A - B) / (double)x;
  cout << fixed << setprecision(15) << min(X1, X2) << "\n";
  return 0;
}
