棋子 · 2020年02月17日

Definition of variables

I have an experience to develop C code for different microcontrollers and DSPs. However, this is first time to develop code for Arm Core microcontrollers. I am using STM32F334 and STM32F745 for different projects. Last couple of weeks, I have learnt to control peripherals and I hadn't calculated any mathematical expression. I started to write mathematical calculations and I realized they took a lot of time.

1 个回答 得票排序 · 时间排序
极术小姐姐 · 2020年02月17日

What toolchain are you using?

Did you have the FPU enabled in all cases?

Remember that standard 'C' treats an "unadorned" floating constant as double.

Floating point will always take longer than integer arithmetic.

So, unless you really need it, stick to integer arithmetic!

Especially when it comes to something like a simple divide by 2 - which can be implemented as a shift.

https://floating-point-gui.de/

https://docs.oracle.com/cd/E1...

你的回答
关注数
1
收藏数
0
浏览数
1948
极术小姐姐
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息