Staging
v0.5.1
https://github.com/python/cpython
Revision 8ce9f162595e500af16d8543e896ceeb815e51ac authored by Tim Peters on 27 August 2004, 01:49:32 UTC, committed by Tim Peters on 27 August 2004, 01:49:32 UTC
1. u1.join([u2]) is u2
2. Be more careful about C-level int overflow.

Since PySequence_Fast() isn't needed to achieve #1, it's not used -- but
the code could sure be simpler if it were.
1 parent 00f8da7
Raw File
Tip revision: 8ce9f162595e500af16d8543e896ceeb815e51ac authored by Tim Peters on 27 August 2004, 01:49:32 UTC
PyUnicode_Join(): Two primary aims:
Tip revision: 8ce9f16
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