0% found this document useful (0 votes)
35 views2 pages

After Lab-1 (Ans-1)

Signed integers range from -32,768 to 32,767 with a size of 2 bytes (16 bits). Unsigned integers range from 0 to 65,535 with a size of 2 bytes. Long signed integers range from -2,147,483,648 to 2,147,483,647 with a size of 4 bytes (32 bits), while long unsigned integers range from 0 to 4,294,967,295 with a size of 4 bytes. Signed characters range from -128 to 127 with a size of 1 byte (8 bits), and unsigned characters range from 0 to 255 with a size of 1 byte. Floats have a size of 4 bytes (32 bits) and range from 1.2e-38

Uploaded by

Anshul Gour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

After Lab-1 (Ans-1)

Signed integers range from -32,768 to 32,767 with a size of 2 bytes (16 bits). Unsigned integers range from 0 to 65,535 with a size of 2 bytes. Long signed integers range from -2,147,483,648 to 2,147,483,647 with a size of 4 bytes (32 bits), while long unsigned integers range from 0 to 4,294,967,295 with a size of 4 bytes. Signed characters range from -128 to 127 with a size of 1 byte (8 bits), and unsigned characters range from 0 to 255 with a size of 1 byte. Floats have a size of 4 bytes (32 bits) and range from 1.2e-38

Uploaded by

Anshul Gour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Bit lengths and variable ranges of the variable types

Anshul Gour

August 28, 2019

1 Integer Type
Integers are further subdivided into two categories.

1.Signed Integer
Signed integer has storage size of 2 bytes that is equal to 16 bits. Its values ranges between -32,768 to 32,767.
CALCULATIONS:-
2 Bytes = 16 bits
1 bit can store 2 values
So, 16 bits store 216 values.
216 = 65536
Signed integer takes both positive and negative values.
65536/2 =32768
And 0 is also included. Hence, Range is -32768 to 32767.

2.Unsigned integer
Unsigned Integer has storage size of 2 bytes that is equal to 16 bits. It only takes positive values. Its values
ranges between 0 to 65535.
CALCULATIONS:
2 Bytes= 16 bits
1 bit can store 2 values
So, 16 bits store 216 values.
216 = 65536
Unsigned Integers takes only postive values including 0.
Hence Range is 0 to 65535.

2 Long Integer
Long Integers are further subdivided into two categories.

1. Long Signed Integer


Long Signed integer has storage size of 4 bytes that is equal to 32 bits. Its values ranges between -2147483648
to 2147483647.
CALCULATIONS:-
4 Bytes = 32 bits
1 bit can store 2 values
So, 16 bits store 232 values.
232 = 4294967296
Signed integer takes both positive and negative values.
4294967296/2 =-2147483648
And 0 is also included. Hence, Range is -2147483648 to 2147483647 .

1
1. Long Unsigned Integer
Long unsigned integer has storage size of 4 bytes that is equal to 32 bits. Its values ranges between 0 to
4294967295.
CALCULATIONS:-
4 Bytes = 32 bits
1 bit can store 2 values
So, 16 bits store 232 values.
232 = 4294967296
Signed integer takes positive values including 0.
Hence, Range is 0 to 4294967295 .

3 Char Type
Characters are further subdivided into two categories.

1.Signed Character
Signed character has storage size of 1 byte that is equal to 8 bits. Its values ranges between -128 to 127.

CALCULATIONS:-
1 Byte = 8 bits
1 bit can store 2 values
So, 8 bits store 28 values.
28 = 256
Signed integer takes both positive and negative values.
256/2 =128
And 0 is also included. Hence, Range is -128 to 127.

2.Unsigned Character
Unsigned character has storage size of 1 byte that is equal to 8 bits. It only takes positive values. Its values
ranges between 0 to 255.
CALCULATIONS:
1 Byte= 8 bits
1 bit can store 2 values
So, 8 bits store 28 values.
28 = 256
Unsigned Integers takes only postive values including 0.
Hence Range is 0 to 255.

4 Float
Float has storage size of 4 bytes that is equal to 32 bits. Its values ranges between 1.2e-38 to 3.4e+38.

5 Double
Double has storage size of 8 bytes that is equal to 64 bits. Its values ranges between 2.3e-308 to 1.7e+308.

6 Long Double
Long Double has storage size of 10 bytes that is equal to 80 bits. Its values ranges between 3.4e-4932 to
1.1e+4932.

You might also like