FLINT3.7.0-dev

qqbar_binary_op

Synopsis#include <flint/qqbar.h>
void qqbar_binary_op(qqbar_t res, const qqbar_t x, const qqbar_t y, int op)source

Sets res to x + y, x - y, x y or x / y for op = 0, 1, 2, 3. Trivial cases such as rational operands are not handled here (the public arithmetic functions do that), but structure is exploited to avoid factoring a composed polynomial of degree \deg x \deg y when possible.

In order: equal operands are handled directly; if an operand is quadratic, closed formulas (both quadratic) or a norm of degree 2 \deg x certified irreducible modulo a prime are used; for operands of equal degree at least 4, a rational result is guessed and verified; if one operand lies in the field generated by the other, or both in a common cyclotomic field (detected by modular tests), the operands are expressed in that field with LLL and exact verification and the result is computed by linear algebra there, or the minimal polynomial of the result is guessed with LLL and proved by a numerical evaluation at sufficient precision, all within a budget proportional to the estimated cost of the fallback; distinct conjugates use the symmetric composed polynomial of half degree; otherwise the composed polynomial is factored and the factor vanishing at the numerical value is selected. See Arithmetic with algebraic numbers.

Cite this page

The FLINT team, “qqbar_binary_op (qqbar.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/qqbar/qqbar_binary_op.html (generated 2026-10-20).