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

📄 fixmatrix.cpp

📁 这是我本人编写的一个32位定点小数运算的函数库。对于没有浮点运算器的场合
💻 CPP
字号:
// FixMatrix.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <math.h>

void FixMiniMfcc32(long mini[],const long mfcc[39],int n);
void MiniMfcc(double mini[],const double mfcc[39],int n);

int main(int argc, char* argv[])
{
	double x[39],y[39];
	long ix[39],iy[39];

	double sum=0;
	for (int i=0;i<10000;i++) {
		for (int j=0;j<39;j++) {
			x[j]=(double)rand()/RAND_MAX;
			ix[j]=(long)(x[j]*1024*1024+0.5);
		}
		MiniMfcc(y,x,39); FixMiniMfcc32(iy,ix,39);
		for (j=0;j<39;j++) {
			double d=fabs(y[j]-(double)iy[j]/(1024*1024));
			sum+=d;
		}
	}

	printf("Aver delta=%lf\n",sum/10000);
	getch();
	return 0;
}

⌨️ 快捷键说明

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