add numerical recipes library
This commit is contained in:
14
lib/nr/ansi/recipes/dpythag.c
Normal file
14
lib/nr/ansi/recipes/dpythag.c
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#include <math.h>
|
||||
#define NRANSI
|
||||
#include "nrutil.h"
|
||||
|
||||
double dpythag(double a, double b)
|
||||
{
|
||||
double absa,absb;
|
||||
absa=fabs(a);
|
||||
absb=fabs(b);
|
||||
if (absa > absb) return absa*sqrt(1.0+DSQR(absb/absa));
|
||||
else return (absb == 0.0 ? 0.0 : absb*sqrt(1.0+DSQR(absa/absb)));
|
||||
}
|
||||
#undef NRANSI
|
||||
Reference in New Issue
Block a user