hypot.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 44 行

C
44 行
字号
/*	@(#)hypot.c	4.1	12/25/82	*//* * sqrt(a^2 + b^2) *	(but carefully) */double sqrt();doublehypot(a,b)double a,b;{	double t;	if(a<0) a = -a;	if(b<0) b = -b;	if(a > b) {		t = a;		a = b;		b = t;	}	if(b==0) return(0.);	a /= b;	/*	 * pathological overflow possible	 * in the next line.	 */	return(b*sqrt(1. + a*a));}struct	complex{	double	r;	double	i;};doublecabs(arg)struct complex arg;{	double hypot();	return(hypot(arg.r, arg.i));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?