arcHav static method

double arcHav(
  1. double 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 the range [0, 1], and the result is positive.

Implementation

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