The relative error is defined by the simple formula:
$$\text{Rel. Error} = \frac{|v_\text{approx}-v_\text{analytical}|}{v_\text{analytical}}$$
but what if the theoretical value $v_\text{analytical}$ should be $0$? then our relative error is undefined.... this is also quite a common occurs. If our analytical function is $x^2$ then at its $x=0$ we have a problem.
I'm trying to program this on a computer. How do I make sure that I don't have any problems with this formula?