sinc.c

来自「该程序是用vc开发的对动态数组进行管理的DLL」· C语言 代码 · 共 76 行

C
76
字号
 /* Copyright (c) Colorado School of Mines, 2003.*//* All rights reserved.                       *//*********************** self documentation **********************//*****************************************************************************SINC - Return SINC(x) for as floats or as doublesfsinc		return float value of sinc(x) for x input as a floatdsinc		return double precision sinc(x) for double precision x******************************************************************************Function Prototype:float fsinc (float x);double dsinc (double x);******************************************************************************Input:x		value at which to evaluate sinc(x)Returned: 	sinc(x)******************************************************************************Notes:    sinc(x) = sin(PI*x)/(PI*x) ******************************************************************************Author:  Dave Hale, Colorado School of Mines, 06/02/89*****************************************************************************//**************** end self doc ********************************/#include "cwp.h"float fsinc (float x)/*****************************************************************************Return sinc(x) = sin(PI*x)/(PI*x) (float version)******************************************************************************Input:x		value at which to evaluate sinc(x)Returned: 	sinc(x)******************************************************************************Author:  Dave Hale, Colorado School of Mines, 06/02/89*****************************************************************************/{	float pix;	if (x==0.0) {		return 1.0;	} else {		pix = (float)(PI*x);		return (float)(sin(pix)/pix);	}}double dsinc (double x)/*****************************************************************************Return sinc(x) = sin(PI*x)/(PI*x) (double version)******************************************************************************Input:x		value at which to evaluate sinc(x)Returned:	sinc(x)******************************************************************************Author:  Dave Hale, Colorado School of Mines, 06/02/89*****************************************************************************/{	double pix;	if (x==0.0) {		return 1.0;	} else {		pix = PI*x;		return sin(pix)/pix;	}}

⌨️ 快捷键说明

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