D-stability and real and complex quadratic forms