solve_univariate: fix domain_check

* Fix some missing branches
* flatten if-else branches by using if-elif-else