Staging
v0.5.1
https://github.com/python/cpython
Revision a1aea3a6c4717d97e2b8079c46b17820f90cab95 authored by Fred Drake on 23 September 2003, 05:21:02 UTC, committed by Fred Drake on 23 September 2003, 05:21:02 UTC
1 parent d452fe0
Raw File
Tip revision: a1aea3a6c4717d97e2b8079c46b17820f90cab95 authored by Fred Drake on 23 September 2003, 05:21:02 UTC
add entry for 2.3.1
Tip revision: a1aea3a
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