⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sin.c

📁 c 语言编译器 源代码- c compiler
💻 C
字号:
/*#ident	"@(#)cfront:lib/complex/sin.c	1.3"*/#include "complex.h"#include "const.h"complexsin(complex z)/*	sine of z: -i * sinh(i*z)*/{	complex	y = complex(-z.im, z.re);	/*  i * z */	y = sinh(y);				/*  csinh(y) */	return complex(y.im, -y.re);		/*  -i * y */}complexsinh(complex z)/*	The hyperbolic sine*/{	double cosh_x, sinh_x, cos_y, sin_y;	c_exception	ex( "sinh", z );	int write( int , char *, unsigned int );#define SINH_GOOD	1e7	if (ABS(z.im) > SINH_GOOD)	{ 		ex.type = OVERFLOW;		if ( !complex_error( ex ))			errno = ERANGE;    		return ex.retval;    	}    	cos_y = cos(z.im);    	sin_y = sin(z.im);	if (z.re > MAX_EXPONENT)	{		ex.type = OVERFLOW;		ex.retval.re = (cos_y >= 0) ? HUGE : -HUGE;		ex.retval.im = (sin_y >= 0) ? HUGE : -HUGE;		if ( !complex_error( ex ))			errno = ERANGE;		return ex.retval;    	}	else if (z.re < MIN_EXPONENT)	{		ex.type = OVERFLOW;		ex.retval.re = (cos_y >= 0) ? -HUGE : HUGE;		ex.retval.im = (sin_y >= 0) ? HUGE : -HUGE;		if ( !complex_error( ex ))			errno = ERANGE;		return ex.retval;    	}	else	{    		double pos_exp = exp(z.re);     		double neg_exp = 1/pos_exp;   		cosh_x = (pos_exp + neg_exp)/2;   		sinh_x = (pos_exp - neg_exp)/2;    	}	return complex(cos_y*sinh_x, sin_y*cosh_x);}

⌨️ 快捷键说明

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