Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: a9917bce4123ae1cf135d2a114e947cda4d4ee35 authored by cvs2svn on 28 September 2005, 03:38:39 UTC
This commit was manufactured by cvs2svn to create tag 'r242'.
Tip revision: a9917bc
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