proteus 1.9.0
C/C++/Fortran libraries
Loading...
Searching...
No Matches
Dpythag.cpp
Go to the documentation of this file.
1#include <math.h>
2static double dsqrarg;
3#define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg)
4
5double 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
double dpythag(double a, double b)
Definition Dpythag.cpp:5
#define DSQR(a)
Definition Dpythag.cpp:3