Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: b4c8cba4b4405f5abf394ffc8286a1dd13732a8f authored by Anthony Baxter on 23 October 2006, 15:38:59 UTC
set svn:ignore. anal retentiveness, makes it easier to spot actual problems
Tip revision: b4c8cba
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