function arcHav(x) {
  return 2 * Math.asin(Math.sqrt(x));
}
Computes inverse haversine. Has good numerical stability around 0.
arcHav(x) == acos(1 - 2 * x) == 2 * asin(sqrt(x)).
The argument must be in [0, 1], and the result is positive.