how I can know what numbers can be stored with the two' s complement to avoid overflow? I would appreciate any answer :) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how I can know what numbers can be stored with the two' s complement to avoid overflow? I would appreciate any answer :)

16th Mar 2020, 8:21 PM
Dario Ortolano
Dario Ortolano - avatar
1 Answer
0
Any number from -2^(n-1) to +(2^(n-1))-1 can be stored. Where n is number of bits. So for 8-bit, it can only store -128 to +127 and 4-bit will store -8 to +7
16th Mar 2020, 8:49 PM
Ore
Ore - avatar