Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

doubt on data types ( cnipf dtx)

Former Member
0 Likes
753

data : a1 type i .

now howmany values can i hold it seems it can hold 4 bytes .

1 byte = 8 bits

1bit = 1 / 0

so 8 bits = 8 * 1 = 8 (abcdefgh)

so 4 bytes = 4 * 8 = 32 bits.

it means a1 can hold 9999999999999999999999999999999

please explain if it is not true.

data : a1 type i .

now howmany values can i hold it seems it can hold 4 bytes .

1 byte = 8 bits

1bit = 1 / 0

so 8 bits = 8 * 1 = 8 (abcdefgh)

so 4 bytes = 4 * 8 = 32 bits.

it means a1 can hold 9999999999999999999999999999999

please explain if it is not true.

2 REPLIES 2
Read only

varma_narayana
Active Contributor
0 Likes
714

Hi ..

Data type I (Integer) can hold max 10 digit numbers.

Here 4 bytes does not mean you can store upto 32 digits value.

but the calcuation is like

for 1 byte it can store max 2 power 8 values = 256

like that 4 bytes means maximum 2 power 32 .

beyond that limit raises an ARITHMETIC_OVERFLOW exception.

Hope this gives the idea.

<b>Reward for helpful solutions.</b>

Read only

Former Member
0 Likes
714

1 byte = 8 bits

1bit = 1 / 0

so 8 bits = 8 * 1 = 8 (abcdefgh)

so 4 bytes = 4 * 8 = 32 bits.

in this 32 bits one bit is reserved for sign ( + or -) now in the remaining 31 bits you can use for storing the value i.e is maximum 2^31 - 1 = 2147483647( i.e. yuou can put 1 or 0 for any bit and by binary to decimal conversion it comes 2147483647).

generally the range is from -2147483648 to 2147483647 for an integer.

regards

shiba dutta