copypasted kapenga's code for qsolve_roots.c, fixed first unit test