#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (b > a) {
    printf("-1\n");
    return 0;
  } else if (a == b) {
    printf("%d\n", a);
    return 0;
  } else {
    int v1 = ((a + b) / b);
    v1 % 2 == 0 ? v1 = v1 : v1 = v1 - 1;
    int v2 = ((a - b) / b);
    v2 % 2 == 0 ? v2 = v2 : v2 = v2 - 1;
    double ans1 = ((double)(a + b) / (v1));
    double ans2 = ((double)(a - b) / (v2));
    printf("%.9f\n", min(ans1, ans2));
  }
  return 0;
}
