This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM2434:回复:AM2434:UINT32至 float32类型转换问题

Guru**** 2524460 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1305525/am2434-re-am2434-issue-of-uint32-to-float32-type-conversion

器件型号:AM2434

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1272183/am2434-issue-of-uint32-to-float32-type-conversion

根据上一个问题的说明、我想 问为什么这样的类型转换会导致程序崩溃?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我们的许多 SDK 专家目前正在节日期间休假、因此请预计会有响应延迟。 我已要求另一个团队查看此问题、但如果他们无法提供帮助、可能需要从1月开始获取反馈。

    此致、

    拉尔夫·雅各比

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Andy、您好!

    程序崩溃的可能原因是整数的格式(uint32_t)是32位浮点(Float32)的非法格式。 执行数据类型转换的正确方法是使用类型转换:

    uint32_t intVar = 0x10000000;

    浮点 fltVar = 0.1;

    fltVar =(float) intVar;

    此致、

    明