Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: bb5cd08688a92bcb4cf255d9009dcbfaba0deb8b authored by Barry Warsaw on 02 April 2008, 23:33:27 UTC
release.py induced and manual editing steps for 3.0a4.
Tip revision: bb5cd08
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