Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: 4e02a97bd786bde6485210bd1c0f36fdc8ea8a56 authored by cvs2svn on 12 August 1998, 02:38:11 UTC
This commit was manufactured by cvs2svn to create tag 'r152a1'.
Tip revision: 4e02a97
hypot.c
/* hypot() replacement */

#include "config.h"
#include "myproto.h"
#include "mymath.h"

double hypot(x, y)
	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