struct CComplex{float r, i;//pile of overloads...};int QuadraticRoots(CComplex coef[3], CComplex roots[2]){static float fEplison = 0.00001;CComplex a = coef[2];CComplex b = coef[1];CComplex c = coef[0];if(abs(a) < fEplison) { //They we're just kidding return LinearRoots(coef, roots); }CComplex D = sqrt(b*b - 4*a*c);CComplex negb = -b;CComplex twicea = 2*a;roots[0] = (negb + D) / twicea;roots[1] = (negb - D) / twicea;return(2);}
|
Magmai Kai Holmlor
- The disgruntled & disillusioned
Edited by - Magmai Kai Holmlor on May 20, 2001 6:48:43 PM
Edited by - Magmai Kai Holmlor on May 20, 2001 6:50:40 PM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara