Libpoly only allows to create real algebraic numbers from dyadic rationals. For non-dyadic rationals, we need to create a polynomials and create it the general way. Libpoly requires all defining polynomials to be primitive, in particular the leading coefficient must be positive. We would always have it negative, which only becomes a problem if libpoly has assertions enabled, though.
Fixes #8126.
else
{
d_value = poly::AlgebraicNumber(
- poly::UPolynomial({numerator(pr), -denominator(pr)}),
+ poly::UPolynomial({-numerator(pr), denominator(pr)}),
poly::DyadicInterval(floor(pr), ceil(pr)));
}
#endif