#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (b > a)
    puts("-1");
  else if (b == a)
    printf("%d", b);
  else {
    int k = (a - b) / (b << 1);
    double ans = (double)(a - b) / 2 / (k - 1);
    if ((double)(a - b) / 2 / k >= b) ans = (double)(a - b) / 2 / k;
    if ((double)(a - b) / 2 / (k + 1) >= b) ans = (double)(a - b) / 2 / (k + 1);
    k = (a + b) / (b << 1);
    if ((double)(a + b) / 2 / (k - 1) >= b)
      ans = min(ans, (double)(a + b) / 2 / (k - 1));
    if ((double)(a + b) / 2 / k >= b) ans = min(ans, (double)(a + b) / 2 / k);
    if ((double)(a + b) / 2 / (k + 1) >= b)
      ans = min(ans, (double)(a + b) / 2 / (k + 1));
    printf("%.10f", ans);
  }
}
