#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  scanf("%I64d%I64d", &a, &b);
  if (b > a)
    puts("-1");
  else if (a % b == 0 && a / b % 2 == 1) {
    printf("%.12lf\n", (double)b);
  } else {
    int k;
    double x1 = (a + b) / 2.0;
    k = x1 / b;
    if (k) x1 /= k;
    double x2 = (a - b) / 2.0;
    k = x2 / b;
    if (k) x2 /= k;
    if (x1 < b && x2 < b) {
      puts("-1");
      return 0;
    }
    if (x1 > b && x2 > b)
      printf("%.12lf\n", min(x1, x2));
    else if (x1 < b && x2 > b)
      printf("%.12lf\n", x2);
    else
      printf("%.12lf\n", x1);
  }
  return 0;
}
