不会是把整个math库全编译进去了吧
使用exp
U16 Ch0,Ch1,lux;
Ch0=AdcDecode(a0);
Ch1=AdcDecode(a1);
lux=(U16)(5*(Ch0-Ch1)*0.39*exp(-0.181*Ch1*Ch1/(Ch0-Ch1)/(Ch0-Ch1)));
Program space used F68h ( 3944) of 1000h words ( 96.3%)
不用exp
U16 Ch0,Ch1,lux;
Ch0=AdcDecode(a0);
Ch1=AdcDecode(a1);
lux=(U16)(5*(Ch0-Ch1)*0.39*(-0.181*Ch1*Ch1/(Ch0-Ch1)/(Ch0-Ch1)));
Program space used B4Ah ( 2890) of 1000h words ( 70.6%)
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
for (i = 1; (t <-0.00003 || t>0.00003); t *= q / ++i) y += t;
vc中验证
最大误差在
0.945568 0.945539 0.000029
精度足够
现在是
Program space used DBEh ( 3518) of 1000h words ( 85.9%)
一周热门 更多>