Function

NumCosmoMathpoly_roots_real_quadratic

Declaration [src]

gint
ncm_poly_roots_real_quadratic (
  const gdouble* a,
  gdouble* roots
)

Description [src]

Real roots of a genuine quadratic ($a_2\neq0$ required — callers with a possibly-degenerate leading coefficient should check for that themselves, or use ncm_poly_roots_real_quartic_or_lower() further down the chain). Uses the numerically stable form of the quadratic formula (computing the larger root directly, the other via the product-of-roots identity) to avoid cancellation.

Parameters

a

Type: An array of gdouble

Ascending coefficients $a_0+a_1x+a_2x^2$, $a_2\neq0$.

The array must have 3 elements.
The data is owned by the caller of the function.
roots

Type: An array of gdouble

The real roots found.

The argument will be set by the function.
The array must have 2 elements.
The returned data is owned by the function.

Return value

Type: gint

The number of real roots found (0, 1, or 2).