TI中文支持网
TI专业的中文技术问题搜集分享网站

Floating Point mode (–fp_mode)中relaxed和strict区别是什么?

我用的F28379D的开发板,在使用函数sqrt后,CCS建议我把fp_mode改成relaxed。请问relaxed和strict的区别是什么呢?

Susan Yang:

您可以参考

www.ti.com/…/spru514v.pdf

的 2.3.3 Miscellaneous Useful Options

,

Susan Yang:

–fp_mode
The main compiler option is the –fp_mode option. This option controls the compiler's overall floating-point optimization strategy.

–fp_mode=relaxed

Relaxed mode prioritizes speed over strict correctness. In relaxed mode, the compiler may perform speed optimizations at the expense of reducing the precision of some calculations, typically a tiny amount. For instance, (X/3) is not precisely equivalent to (X*(1.0/3)), but in relaxed mode, the compiler is allowed to make this transformation anyway, as multiplication is much faster than division.

–fp_mode=strict

Strict mode enforces strict IEEE-754 semantics, disabling all unsafe optimizations. The compiler will still perform optimizations that are provably safe, such as (X/2) -> (X*0.5). Using –fp_mode=strict sets –fp_reassoc=off by default.

software-dl.ti.com/…/sdto_cgt_floating_point_optimization.html

,

EE搬砖工:

了解了,感谢!

,

Susan Yang:

不客气~

赞(0)
未经允许不得转载:TI中文支持网 » Floating Point mode (–fp_mode)中relaxed和strict区别是什么?
分享到: 更多 (0)