arcHav static method

num arcHav(
  1. num 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.

Implementation

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