您好,欢迎来电子发烧友网! ,新用户?[免费注册]

您的位置:电子发烧友网>源码下载>DSP编程>

DSP的C语言与汇编程序库

大小:41.1 KB 人气: 2011-06-03 需要积分:0

**********************************************************************/
/*                         SPALIB.C                                   */
/*            SUBPROGRAMS IN ALPHABETICAL ORDER                       */
/*              IN THE C PROGRAMMING LANGUAGE                         */
/*                                                                    */
/**********************************************************************/

/* NOTE: The user may wish to include the following in other programs */

/* .................Begin include file.................*/
/* Latest date: 06/23/92 */

#include

/* In the VMS compiler, M_PI is not defined in math.h */

#ifdef vms
#define M_PI    3.14159265358979323846
#endif
#ifndef KR
#define M_PI    3.14159265358979323846
#endif

#define FALSE 0
#define TRUE 1
#define BIG 1e10
#define SMALL 1e-10
#define ORDER5 1e-5
#define ORDER4 1e-4
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define MAX(a,b) ((a) >= (b) ? (a) : (b))

/* Table of constant values */

static long neg_i1 = -1;
static long pos_i1 = 1;
static long pos_i2 = 2;
static long pos_i4 = 4;
static long pos_i5 = 5;
static float neg_f1 = -1.0;
static float pos_f2 = 2.0;
static double pos_d10 = 10.0;

typedef struct {
 float r, i;
} complex;

typedef struct {
 double r, i;
} doublecomplex;

/* .................End of include file.................*/

/* SPBFCT     11/14/85 */
/* GENERATES (I1)!/(I1-I2)!=I1*(I1-1)*...*(I1-I2+1). */
/* NOTE: 0!=1 AND SPBFCT(I,I)=SPBFCT(I,I-1)=I!. */

#ifndef KR
double spbfct(long *i1, long *i2)
#else
double spbfct(i1, i2)
long *i1, *i2;
#endif
{
    /* Local variables */
    long i;
    double ret_val;

    ret_val = 0.0;
    if (*i1 < 0 || *i2 < 0 || *i2 > *i1)
    {
 return(ret_val);
    }

    ret_val = 1.0;
    for (i = *i1 ; i >= (*i1 - *i2 + 1) ; --i)
    {
 ret_val *= (double) i;
    }

非常好我支持^.^

(1) 100%

不好我反对

(0) 0%

      发表评论

      用户评论
      评价:好评中评差评

      发表评论,获取积分! 请遵守相关规定!