Staging
v0.5.1
https://github.com/python/cpython
Revision eaf3c9bed79cc6d509ac40fadaae93e5fcdcc0b9 authored by Jack Jansen on 15 August 1997, 14:36:45 UTC, committed by Jack Jansen on 15 August 1997, 14:36:45 UTC
1 parent 69b43ed
Raw File
Tip revision: eaf3c9bed79cc6d509ac40fadaae93e5fcdcc0b9 authored by Jack Jansen on 15 August 1997, 14:36:45 UTC
Added #include <string.h> for memcpy()
Tip revision: eaf3c9b
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