gpt4 book ai didi

c++ - 如何防止C中的双重溢出?

转载 作者:行者123 更新时间:2023-11-28 06:25:37 25 4
gpt4 key购买 nike

我正在从这篇文章的主题中寻找问题的答案。在检查整数溢出时我没有遇到问题,但我不知道如何用双变量处理它。如果有人能指出我正确的方向,我将不胜感激。

提前致谢

最佳答案

在 IEEE-754 中,如果舍入模式是 roundTiesToEven(默认),您可以通过检查正常操作数的无穷大结果来检测溢出

(IEEE-754:2008, 7.4 Overflow) "roundTiesToEven and roundTiesToAway carry all overflows to ∞ with the sign of the intermediate result"

关于c++ - 如何防止C中的双重溢出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28581323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com