long _IQint( _iq A)和_iq _IQfrac( _iq A) ,当A为负数时,得到的结果和手册讲得不对,如下的代码,请问是我下面写的程序有问题吗
_iq Y0 = _IQ(2.3456);
_iq Y1 = _IQ(-2.3456);
long Y0int, Y1int;
_iq Y0frac, Y1frac;
Y0int = _IQint(Y0); // Y0int = 2
Y1int = _IQint(Y1); // Y1int = -2
Y0frac = _IQfrac(Y0); // Y0frac = 0.3456
Y1frac = _IQfrac(Y1); // Y1frac = -0.3456
GUI_DispFloatFix (Y0int,9,4);GUI_DispString("
");//显示为0002.000
GUI_DispFloatFix (Y1int,9,4);GUI_DispString("
");//显示为-003.000
GUI_DispFloatFix (_IQtoF(Y0frac),9,4);GUI_DispString("
");//显示为0000.3456
GUI_DispFloatFix (_IQtoF(Y1frac),9,4);GUI_DispString("
");//显示为0000.6544
此帖出自
小平头技术问答
一周热门 更多>