mathutil.c
来自「傅立叶变换和小波变换是图像压缩的重要工具。该代大戏是利用小波变换进行图像压缩。」· C语言 代码 · 共 70 行
C
70 行
#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 + =
减小字号Ctrl + -
显示快捷键?