\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.8 - Number Types

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
RootOf_2 Concept Reference
Concepts

## Definition

Concept to represent algebraic numbers of degree up to 2 over a `RealEmbeddable` `IntegralDomain` `RT`.

A model of this concept is associated to this `RT` via `CGAL::Root_of_traits<RT>`, which provides `Root_of_2` as a public type. Moreover, `CGAL::Root_of_traits<RT>` provides the public type `Root_of_1`, which is the quotient field of `RT`. We refer to `Root_of_1` as FT (for field type).

The model of `RootOf_2` is a `RealEmbeddable` `IntegralDomain`, which is `ImplicitInteroperable` with `RT`, `FT`. In particular, it provides the comparison operators `==, !=, <, >, <=, >=` as well as the `sign` and `compare` functions needed to compare elements of types `RootOf_2, RT` and `FT`. It also provides all arithmetic operators `+,-,*,/` among elements of type `RootOf_2` as well as mixed forms with `RT` and `FT`.

However, it is important to note that arithmetic operations among elements of `RootOf_2` are only allowed in the special case when they have been constructed from equations having the same discriminant, that is, if they are defined in the same algebraic extension of degree 2.

Besides construction from `int, RT` and `FT` the following functions provide special construction for extensions of degree 2:

- `CGAL::make_root_of_2()`
- `CGAL::make_sqrt()`

Refines:

  `DefaultConstructible`

  `CopyConstructible`

  `FromIntConstructible`

  `ImplicitInteroperable` with RT

  `ImplicitInteroperable` with FT

Has Models:

  `double` (not exact)

  `CGAL::Sqrt_extension`

See Also
  `CGAL::make_root_of_2<RT>`
  `CGAL::make_sqrt<RT>`
  `CGAL::compute_roots_of_2<RT,OutputIterator>`
  `CGAL::Root_of_traits<RT>`
  `AlgebraicKernelForCircles::PolynomialForCircles_2_2`
  `AlgebraicKernelForCircles`

## Operations
Same for operator `-,*,/,!=,<=,>,>=` as well as mixed forms with `RT` and `FT`.
RootOf_2 & | operator+= (const RootOf_2 &a)
RootOf_2 | operator+ (const RootOf_2 &a, const RootOf_2 &b)
bool | operator== (const RootOf_2 &a, const RootOf_2 &b)
bool | operator< (const RootOf_2 &a, const RootOf_2 &b)

## Member Function Documentation

RootOf_2 RootOf_2::operator+ | ( | const RootOf_2 & | a,
|  | const RootOf_2 & | b
| ) |  |

Precondition
  `a` and `b` are defined in the same extension.

RootOf_2& RootOf_2::operator+= | ( | const RootOf_2 & | a) |  |

Precondition
  `*this` and `a` are defined in the same extension.