How to account for negative numbers during revising quadratic numbers

my code works when determinant is positive but it doesn’t work for as it is trying to calculate root of negative number