Staging
v0.8.1
https://github.com/python/cpython
Revision 675bac026e8df0d8a787dd7f88fa82e04ee70191 authored by Raymond Hettinger on 16 September 2003, 04:55:32 UTC, committed by Raymond Hettinger on 16 September 2003, 04:55:32 UTC
1 parent c866ac7
Raw File
Tip revision: 675bac026e8df0d8a787dd7f88fa82e04ee70191 authored by Raymond Hettinger on 16 September 2003, 04:55:32 UTC
Backport addition of the __all__ attribute for unittest.py
Tip revision: 675bac0
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