Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 8 - QuickDraw GX Mathematics / QuickDraw GX Mathematics Reference
Mathematical Functions / Linear and Quadratic Roots


QuadraticRoot

You can use the QuadraticRoot 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
The QuadraticRoot 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 parameter first. The coefficient b is the parameter control. The coefficient c is the parameter last.

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.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996