Staging
v0.8.1
https://github.com/python/cpython
Revision 56b2c92abbc0be03d8a78b238c039fc2c82e92a2 authored by Georg Brandl on 05 March 2011, 13:55:19 UTC, committed by Georg Brandl on 05 March 2011, 13:55:19 UTC
1 parent a7ce71b
Raw File
Tip revision: 56b2c92abbc0be03d8a78b238c039fc2c82e92a2 authored by Georg Brandl on 05 March 2011, 13:55:19 UTC
Fix tag references in 2.2 branch.
Tip revision: 56b2c92
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