MPC5744P LINFLEXD driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MPC5744P LINFLEXD driver

640 次查看
ykp3036
Contributor I

In MPC5477P LINFLEXD driver, when compute  fraction baudrate, why plus "0.5F" in the end?

ykp3036_0-1677464188408.png

 

0 项奖励
回复
2 回复数

629 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the default float-to-integer conversion in C does not round to the nearest integer, but instead truncates fractional part. So rounding to the nearest integer can be achieved by adding 0.5 and then do a type cast.

BR, Petr

0 项奖励
回复

624 次查看
ykp3036
Contributor I

thanks, 66666666666666

0 项奖励
回复