proteus  1.8.1
C/C++/Fortran libraries
Dpythag.cpp
Go to the documentation of this file.
1 #include <math.h>
2 static double dsqrarg;
3 #define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg)
4 
5 double dpythag(double a, double b)
6 {
7  double absa,absb;
8  absa=fabs(a);
9  absb=fabs(b);
10  if (absa > absb) return absa*sqrt(1.0+DSQR(absb/absa));
11  else return (absb == 0.0 ? 0.0 : absb*sqrt(1.0+DSQR(absa/absb)));
12 }
13 
DSQR
#define DSQR(a)
Definition: Dpythag.cpp:3
dpythag
double dpythag(double a, double b)
Definition: Dpythag.cpp:5