求助关于AI8051U的TFPU使用的问题 | 已提供解决方案,帮测试下
求助关于AI8051U的TFPU使用的问题最近搞无人机用到三角函数运算的情况,
加入TFPU之后运算速度快了很多,
但用到了硬件TFPU库 不支持的 arcsin()和arccos()函数时,
编译是通过的,但无人机直接不受控了(没加硬件TFPU库功能都正常的),
估计不支持的反三角函数计算错误了,这种有什么好的办法解决吗?
浮点库支持atan,所以可以用atan来间接实现asin和acos
以下是实现代码:
float my_asin(float x) { float t = x / (1.0 + sqrt(1.0 - x * x));return 2.0 * atan(t); }
float my_acos(floatx) { float t = sqrt((1.0 - x) / (1.0 + x));return 2.0 * atan(t); }
王昱顺 发表于 2025-6-13 10:04
浮点库支持atan,所以可以用atan来间接实现asin和acos
以下是实现代码:
float my_asin(float x) { float t ...
好的,感谢!我实际测试下。
页:
[1]