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.

[参考译文] RM46L852:使用浮点运算的可能危险

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1174663/rm46l852-possible-dangers-using-floating-point-operations

器件型号:RM46L852

您好!

对于功能安全项目、我们目前正在尝试确定/评估使用浮点数(以及浮点数操作/计算)可能导致的危险。 据我们所知、有许多方法可以存档、例如、对于浮点数、未定义行为。

例如:

  • 除以零、
  • 溢出、
  • 下溢、
  • 通过 lvalue 读取的陷阱表示(来自 C18标准、附件 J.2)、
  • 将一个实浮点降级为另一个实浮点、生成超出可表示范围的值(来自 C18标准、附件 J.2)
  • 浮点分类或比较宏的参数不是真正的浮点类型(来自 C18 Standard、附录 J.2)
  • 等等

 

那么、我们想知道:在使用浮点运算或浮点运算/计算时、会发生什么最糟糕的情况?

  • 是否会发生存储器损坏(只读存储器和/或 RAM)?
  • 是否可以操作程序代码或/和程序流?
  • 或者、使用浮点数还会产生什么其他危险影响?

 

此致

Sebastian Ahrens