Evaluating $\sqrt{\tan(\pi)}$

Question Q9.1.2

$\sqrt{\tan(\pi)} = 0$ is mathematically well-defined, so why does the folllowing calculation fail with a math domain error?

In [x]: math.sqrt(math.tan(math.pi))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-135-7bfdceeef434> in <module>()
----> 1 math.sqrt(math.tan(math.pi))

Solution