SIZE OF INTEGER DATA TYPE AND ITS
RANGE
IF
WE ARE GIVEN THE SIZE OF AN INTEGER DATA TYPE WE CAN DETERMINE ITS RANGE
RANGE
FOR UNSIGNED NUMBERS:
IF
WE ARE DEALING WITH UNSIGNED NUMBERS THEN RANGE FOR 2 BIT NUMBER WOULD BE:
(0 TO(2^2) -1=4)
IF
THE SIZE IS N BITS THEN THE RANGE WOULD BE:
(0 TO (2^N)-1)
RANGE
FOR SIGNED NUMBERS:
IF
WE ARE DEALING WITH SIGNED NUMBERS THEN RANGE FOR 3 BIT NUMBER WOULD BE:
(-(2^3)-1 TO (2^3)-1)
IF
THE SIZE IS N BITS THEN THE RANGE WOULD BE:
(-(2^N)-1 TO (2^N)-1)
No comments:
Post a Comment