arcHav static method

double arcHav(
  1. double x
)

Computes the inverse haversine. Numerically stable around 0.

arcHav(x) == acos(1 - 2x) == 2 × asin(√x).

The argument must be in [0, 1]; the result is non-negative.

Implementation

static double arcHav(double x) => 2 * asin(sqrt(x));