Why does math.acos result in ValueError: math domain error?

You are trying to do acos of a number for which the acos does not exist.

Acos – Arccosine , which is the inverse of cosine function.

The value of input for acos range from -1 <= x <= 1 .

Hence, when trying to do math.acos(1.0000000000000002), you are getting the error.

If you try higher numbers, you will keep getting the same error – math.acos(2) leads to ValueError: math domain error

Leave a Comment