Important: The information in this document is obsolete and should not be used for new development.
QuadraticRoot
You can use theQuadraticRoot
function to calculate the roots of a quadratic equation.
long QuadraticRoot(Fixed first, Fixed control, Fixed last, fract t[]);
first
- The first coefficient.
control
- The second coefficient.
last
- The third coefficient.
t
- An array of fract numbers. On return, it contains the roots of the equation.
- function result
- The number of roots of the quadratic equation. This value may be 0, 1, or 2 (or -1 if all values of t are roots).
DESCRIPTION
TheQuadraticRoot
function returns roots between 0 and 1 for quadratic equations having the form a(1 - t)2 + 2bt(1 - t) + ct2 = 0. The coefficient a is the parameterfirst
. The coefficient b is the parametercontrol
. The coefficient c is the parameterlast
.All roots are returned in increasing order in the
t
array. The array can have at most two values. If a, b, and c are all zero, then the function returns the number -1, indicating that a(1 - t)2 + 2bt(1 - t) + ct2 = 0 for all t.