1.

How To Determine The Maximum Value That A Numeric Variable Can Hold?

Answer»

For integral types, on a machine that USES two’s complement arithmetic (which is just about any machine you’re likely to use), a SIGNED type can hold numbers from –2(number of bits – 1) to +2(number of bits – 1) – 1. An UNSIGNED type can hold VALUES from 0 to +2(number of bits) – 1. For instance, a 16-bit signed INTEGER can hold numbers from –2^15 (–32768) to +2^15 – 1 (32767).

 

For integral types, on a machine that uses two’s complement arithmetic (which is just about any machine you’re likely to use), a signed type can hold numbers from –2(number of bits – 1) to +2(number of bits – 1) – 1. An unsigned type can hold values from 0 to +2(number of bits) – 1. For instance, a 16-bit signed integer can hold numbers from –2^15 (–32768) to +2^15 – 1 (32767).

 



Discussion

No Comment Found