Staging
v0.8.1
https://github.com/python/cpython
Revision 9f839d5b23eff11af3d124d3f38d917cdac6830d authored by Anthony Baxter on 23 October 2006, 15:27:22 UTC, committed by Anthony Baxter on 23 October 2006, 15:27:22 UTC
1 parent 1785d3f
Raw File
Tip revision: 9f839d5b23eff11af3d124d3f38d917cdac6830d authored by Anthony Baxter on 23 October 2006, 15:27:22 UTC
preparing for 2.3.6c1
Tip revision: 9f839d5
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