Ah, so I should include if statements inside sqrt and pow that throws an exception when a sqrt is taken of a negative number?