Staging
v0.8.1
Revision 152b3c2170f7575b13b516d017f950ee50d83a8f authored by Kurt B. Kaiser on 30 August 2007, 06:35:15 UTC, committed by Kurt B. Kaiser on 30 August 2007, 06:35:15 UTC
1 parent f40080f
Raw File
hypot.c
/* hypot() replacement */

#include "pyconfig.h"
#include "pyport.h"

double hypot(double x, double y)
{
	double yx;

	x = fabs(x);
	y = fabs(y);
	if (x < y) {
		double temp = x;
		x = y;
		y = temp;
	}
	if (x == 0.)
		return 0.;
	else {
		yx = y/x;
		return x*sqrt(1.+yx*yx);
	}
}
back to top