scfor123456 发表于 2019-9-28 21:26:59

库函数sqrt()占用时间几个US,有办法减小时间消耗吗?

请高手指点指点

tanic 发表于 2019-9-29 09:45:25

加钱解决问题

wenyangzeng 发表于 2019-9-29 09:50:04

如果芯片自带FPU,就启用FPU,并使用固件库的arm_math.h

liu553824989 发表于 2019-9-29 10:11:01

自己用汇编写肯定可以减少指令,不然用库肯定时间长

mylovemcu 发表于 2019-9-29 10:11:56

不要用库函数呗换一种写法

scfor123456 发表于 2019-10-6 06:45:46

wenyangzeng 发表于 2019-9-29 09:50
如果芯片自带FPU,就启用FPU,并使用固件库的arm_math.h

用FPU能把时间压缩多少?

wenyangzeng 发表于 2019-10-6 11:08:09

scfor123456 发表于 2019-10-6 06:45
用FPU能把时间压缩多少?

开放运算用到浮点运算,使用FPU应该运算速度更快。

bl2019 发表于 2019-10-7 15:23:13

float CarmSqrt(float x){

15.           union{

16.                   int intPart;

17.                   float floatPart;

18.           } convertor;

19.           union{

20.                   int intPart;

21.                   float floatPart;

22.           } convertor2;

23.           convertor.floatPart = x;

24.           convertor2.floatPart = x;

25.           convertor.intPart = 0x1FBCF800 + (convertor.intPart >> 1);

26.           convertor2.intPart = 0x5f3759df - (convertor2.intPart >> 1);

27.           return 0.5f*(convertor.floatPart + (x * convertor2.floatPart));

28.   }
————————————————
版权声明:本文为CSDN博主「jieniyimiao」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:http://blog.csdn.net/u013467442/article/details/41147487

bl2019 发表于 2019-10-7 15:24:09

http://kb.cnblogs.com/page/189867/

scfor123456 发表于 2019-10-9 15:55:51

bl2019 发表于 2019-10-7 15:23
float CarmSqrt(float x){

15.           union{


这个是求开方函数吗?
页: [1] 2
查看完整版本: 库函数sqrt()占用时间几个US,有办法减小时间消耗吗?