def acos(c):
    """acos -  Safe inverse cosine

       Input argument c is shrunk to admissible interval
       to avoid case where a small rounding error causes
       a math domain error.
    """
    from math import acos as _acos
    if c > 1:
        c = 1
    if c < -1:
        c = -1
    return _acos(c)
