QERT 3CW "05 January 2007" "mathcw-1.00"

Table of contents


NAME

qertf, qert, qertl, qertw, qertq, qertll, qertdf, qertd, qertdl, qertdll - roots of quadratic equation

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern int qertf (float a, float b, float c, /*@out@*/ float [/* 2 */] x1, /*@out@*/ float [/* 2 */] x2);

extern int qert (double a, double b, double c, /*@out@*/ double [/* 2 */] x1, /*@out@*/ double [/* 2 */] x2);

extern int qertl (long double a, long double b, long double c, /*@out@*/ long double [/* 2 */] x1, /*@out@*/ long double [/* 2 */] x2);

extern int qertw (__float80 a, __float80 b, __float80 c, /*@out@*/ __float80 [/* 2 */] x1, /*@out@*/ __float80 [/* 2 */] x2);

extern int qertq (__float128 a, __float128 b, __float128 c, /*@out@*/ __float128 [/* 2 */] x1, /*@out@*/ __float128 [/* 2 */] x2);

extern int qertll (long_long_double a, long_long_double b, long_long_double c, /*@out@*/ long_long_double [/* 2 */] x1, /*@out@*/ long_long_double [/* 2 */])

extern int qertdf (decimal_float a, decimal_float b, decimal_float c, /*@out@*/ decimal_float [/* 2 */] x1, /*@out@*/ decimal_float [/* 2 */] x2);

extern int qertd (decimal_double a, decimal_double b, decimal_double c, /*@out@*/ decimal_double [/* 2 */] x1, /*@out@*/ decimal_double [/* 2 */] x2);

extern int qertdl (decimal_long_double a, decimal_long_double b, decimal_long_double c, /*@out@*/ decimal_long_double [/* 2 */] x1, /*@out@*/ decimal_long_double [/* 2 */] x2);

extern int qertdll (decimal_long_long_double a, decimal_long_long_double b, decimal_long_long_double c, /*@out@*/ decimal_long_long_double [/* 2 */] x1, /*@out@*/ decimal_long_long_double [/* 2 */] x2);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Return the roots of the quadratic equation, a*x**2 + b*x + c = 0, defined by the real coefficients, (a,b,c), as two-element argument arrays of real and imaginary parts, (x1[], x2[]).

The roots are always ordered such that Real(x1) <= Real(x2), since that is convenient in root-following applications.

This function is absent from programming-language standards, but a robust implementation is sufficiently intricate that it needs to be a library function.


RETURN VALUES

The function value is -1 if either or both of the roots are indeterminate, in which case the real and imaginary parts are both set to a quiet NaN, and errno is set to EDOM.

The function value is 0 if both roots are real.

The function value is +1 if the roots are complex or pure imaginary.


ERRORS

None.

SEE ALSO

None.