整数溢出概念 [英] Integer overflow concept
本文介绍了整数溢出概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int溢出的工作原理。我的意思是问什么是一个整数值的最终结果如果溢出发生?我需要在纸上理解它。像我给了一个多项选择题:
How int overflow works. I mean to ask what would be the final result of an integer value if an overflow happens? I need to understand it on paper. Like I'm given a multiple choice question:
11 ^ 5产生:
a。 12
b。 14
c。 15
d。 17.
11^5 Produces:
a. 12
b. 14
c. 15
d. 17.
我知道答案是(b)14
,但想知道为什么?
I know the answer is (b)14
, but want to know why?
推荐答案
DecVal BinVal
11 -> 1011
XOR 5 -> 0101
-------
14 -> 1110
fyi,这真的与int溢出没有关系。
fyi, This does not really have anything to do with int overflow.
这篇关于整数溢出概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文