[英]How to prevent double overflow in C?
I'm looking for an answer to the question from the topic of this post. 我正在从本文的主题中寻找问题的答案。 I don't have a problem when it comes to checking for integer overflow, but i don't know how to handle it with double variables.
在检查整数溢出时,我没有问题,但是我不知道如何使用双变量处理它。 I would appreciate if anybody could point me in the right direction.
如果有人能指出我正确的方向,我将不胜感激。
Thanks in advance 提前致谢
In IEEE-754, if the rounding mode is roundTiesToEven (the default) you can detect an overflow by checking an infinity result for normal operands as 在IEEE-754中,如果舍入模式为roundTiesToEven(默认值),则可以通过将正常操作数的无穷结果检查为
(IEEE-754:2008, 7.4 Overflow) "roundTiesToEven and roundTiesToAway carry all overflows to ∞ with the sign of the intermediate result"
(IEEE-754:2008,7.4溢出)“ roundTiesToEven和roundTiesToAway将所有溢出值都以中间结果的符号表示为∞”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.