Staging
v0.5.1
https://github.com/python/cpython
Revision 105f3d4fdc7d7c7d9198ef4c9b2be8d5755584b4 authored by Jeffrey Yasskin on 31 March 2008, 00:35:53 UTC, committed by Jeffrey Yasskin on 31 March 2008, 00:35:53 UTC
1 parent e34c21c
Raw File
Tip revision: 105f3d4fdc7d7c7d9198ef4c9b2be8d5755584b4 authored by Jeffrey Yasskin on 31 March 2008, 00:35:53 UTC
Block the sys.exc_clear -3 warning from threading.py.
Tip revision: 105f3d4
hypot.c
/* hypot() replacement */

#include "Python.h"

#ifndef HAVE_HYPOT
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);
	}
}
#endif /* HAVE_HYPOT */

back to top