Home > Back-end >  Questions about __int128
Questions about __int128

Time:11-29

I want to ask you, is the scope of __int128 data, is 2 ^ 128-1?

CodePudding user response:

Yes 0 to 2 ^ 128-1
So many,

CodePudding user response:

If there is a symbol, is - 2 ^ 127-2 ^ 127-1
If it is unsigned, from 0 to 2 ^ 128-1

CodePudding user response:

Actually this question is very simple, n is total number can say 2 ^ n
Such as 2, represents a total can say four number, if it is unsigned is 0,1,2,3 00,01,10,11 (binary);
Four say 2 ^ 4 number 0,1,2,3,4 16th,,,,,,, 15;
If there is a symbol, highest said the sign bit, positive number can only use n - 1, said it is 1-2 ^ (n - 1), 4 digit is a positive number (1-7) combined with 0, 8 digits, can we know the 4 digit number 16, is a negative number is 1 to 8, four plastic is - 8 to 7.
Simple reasoning, 128, if it is unsigned is 0 (2 ^ 128-1);
Is signed - 2 ^ 127-2 ^ 127-1;

CodePudding user response:

A slip of the pen above
1 to 2 ^ (n - 1) - 1

CodePudding user response:

Note to determine whether as an unsigned number, if there is a symbol for, it is not 128 times the power

CodePudding user response:

Four int32, int this big, can completely said 128 coin out any of the results
  • Related