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

📄 mathutil.c

📁 傅立叶变换和小波变换是图像压缩的重要工具。该代大戏是利用小波变换进行图像压缩。
💻 C
字号:
#include "mathutil.h"

bool float_DoesRoundToZero(void)
{
uword control;
int i;
float f;

	__asm
	{
		FNSTCW control
	}
	
	if ( ! (control & (3<<10)) )
		return false;

	f = 1.4f;
	i = ftoi(f);
	assert( i == 1 );

	f = 2.7f;
	i = ftoi(f);
	assert( i == 2 );

	f = -3.4f;
	i = ftoi(f);
	assert( i == -3 );

	f = -4.7f;
	i = ftoi(f);
	assert( i == -4 );

return true;
}

void float_RoundToZero(void)
{
uword control;
	__asm
	{
		FNSTCW control
	}
	
	control &= ~(3<<10);
	control |=  (3<<10);

	__asm
	{	
		FLDCW control
	}
	
	assert(float_DoesRoundToZero());
}

void float_SinglePrecision(void)
{
uword control;
	__asm
	{
		FNSTCW control
	}
	
	control &= ~(3<<8);

	__asm
	{	
		FLDCW control
	}
}

⌨️ 快捷键说明

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