Return the inverse cosine of ``x``.

    The mathematically exact result lies in the range [0, π].  However, note
    that as a result of rounding to the current context, it's possible for the
    actual value returned to be fractionally larger than π::

        >>> from bigfloat import precision
        >>> with precision(12):
        ...     x = acos(-1)
        ...
        >>> print(x)
        3.1416
        >>> x > const_pi()
        True

def acos(x, context=None):
    """
    Return the inverse cosine of ``x``.

    The mathematically exact result lies in the range [0, π].  However, note
    that as a result of rounding to the current context, it's possible for the
    actual value returned to be fractionally larger than π::

        >>> from bigfloat import precision
        >>> with precision(12):
        ...     x = acos(-1)
        ...
        >>> print(x)
        3.1416
        >>> x > const_pi()
        True

    """
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_acos,
        (BigFloat._implicit_convert(x),),
        context,
    )