Staging
v0.5.1
https://github.com/python/cpython
Revision 3889bfe285ba7a31a8a81875a70cf3a4de76461c authored by Eric Smith on 10 February 2008, 01:44:44 UTC, committed by Eric Smith on 10 February 2008, 01:44:44 UTC
1 parent a822314
Raw File
Tip revision: 3889bfe285ba7a31a8a81875a70cf3a4de76461c authored by Eric Smith on 10 February 2008, 01:44:44 UTC
r60707 does not need porting to py3k from trunk.
Tip revision: 3889bfe
hypot.c
/* hypot() replacement */

#include "Python.h"

#ifndef HAVE_HYPOT
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);
	}
}
#endif /* HAVE_HYPOT */

back to top