Module root

Source
Expand description

Numbers of the form (a + b*sqrt(c)) / d.

A line meets a circle at such a parameter; comparing two such hits, or asking which side of a line one lies on, is a sign question about them. Signs are decided by squaring with case analysis (the approach of CGAL’s Root_of_2), never by evaluating a root, so in exact arithmetic the answer is exact, including an exact zero.

Degree note: sign_root squares once (degree 2 in a, b, c); sign_two_roots squares twice. Mantissa length, and so exact-tier cost, grows with that degree. Both run the interval filter first.

Structs§

Root2
The value (a + b*sqrt(c)) / d, with c >= 0 and d != 0.

Functions§

sign_root
Sign of a + b*sqrt(c) for c >= 0.
sign_two_roots
Sign of p + q*sqrt(c) + r*sqrt(e) for c, e >= 0.