assign5/mat.cpp
//******************************************************************************
// Computes (a2 + b2)1/2 without destructive underflow or overflow.
//
Computes (a2 + b2)1/2 without destructive underflow or overflow.
Computes ( a2 + b2 ) 1 / 2 without destructive underflow or overflow .
double pythag(double a, double b)
{
    double absa, absb;
    absa=fabs(a);
    absb=fabs(b);
    if (absa > absb) return absa*sqrt(1.0+(absb/absa)*(absb/absa));
    else return (absb == 0.0 ? 0.0 : absb*sqrt(1.0+(absa/absb)*(absa/absb)));
}
double pythag ( double a , double b ) { double absa , absb ; absa = fabs ( a ) ; absb = fabs ( b ) ; if ( absa > absb ) return absa * sqrt ( 1.0 + ( absb / absa ) * ( absb / absa ) ) ; else return ( absb == 0.0 ? 0.0 : absb * sqrt ( 1.0 + ( absa / absb ) * ( absa / absb ) ) ) ; }
Computes (a2 + b2)1/2 without destructive underflow or overflow.
Computes ( a2 + b2 ) 1 / 2 without destructive underflow or overflow .