Staging
v0.5.1
https://github.com/python/cpython
Revision a7313d05433da4deedf8068d68e5e944ab51a2cc authored by Andrew M. Kuchling on 31 August 2004, 13:41:04 UTC, committed by Andrew M. Kuchling on 31 August 2004, 13:41:04 UTC
1 parent 57269d0
Raw File
Tip revision: a7313d05433da4deedf8068d68e5e944ab51a2cc authored by Andrew M. Kuchling on 31 August 2004, 13:41:04 UTC
Remove test output for rotor, xreadline
Tip revision: a7313d0
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