C++ gcc关联旗标志是否会禁用float nan值?

发布于 2025-02-06 02:29:07 字数 217 浏览 2 评论 0原文

我正在使用许多浮点数据来处理统计功能。我希望它运行更快,但ofast禁用NAN(fno-finite-Math-Math-gly-code flag),在我的情况下,这是不允许的。

在这种情况下,仅开启cosediative-Math是安全的吗?我认为,即使数组包含NAN,此标志也允许向量数组的向量总和之类的东西。

I'm working with statistic functions with a lot of float data. I want it to run faster but Ofast disable NAN (fno-finite-math-only flag), which is not allowed in my case.

In this case, is it safe to turn on only associative-math ? I think this flag allows things like vectorized sum of vector array, even if the array contains NAN.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何时共饮酒 2025-02-13 02:29:08

来自 docs

注意:重新排序可能会更改零的迹象,也可以忽略nans

因此,如果您想正确处理NAN,则不应使用- fassociative-Math

From the docs:

NOTE: re-ordering may change the sign of zero as well as ignore NaNs

So if you want correct handling of NaNs, you should not use -fassociative-math.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文