Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


auto arcmean(S)(ref Interval!S iv);
Calculate the mean between two points using the arcmean:
tan(0.5 * (atan(l) + atan(r)))
In contrast to the normal mean (0.5 * (l + r)) being a geometric plane, the arcmean favors the mean region more.
Interval!S iv Interval with left point and right point
Splitting point within the interval
See Also:
WolframAlpha visualization of the arc-mean.

References Hormann, W., J. Leydold, and G. Derflinger. "Automatic Nonuniform Random Number Generation." (2004): Formula 4.23