Added divide by zero check for solveQuadratic