Integer storage space | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Integer storage space

How is the integer 32767 stored in binary in two bytes and should it be converted to ascii ??

13th Apr 2021, 10:38 PM
Mamad
Mamad - avatar
11 Answers
+ 2
111111111111111 That’s 15 bits. The sixteenth bit is reserved for signed as positive or negative number.
13th Apr 2021, 10:48 PM
Jerry Hobby
Jerry Hobby - avatar
+ 1
Integers are stored as numbers, typically using two bytes of memory for a small int. When converted to ascii, it uses one byte for each digit, in some cases two bytes per digit. So storing an integer as an ascii string is only useful when you need it as a string. Plus, as a string, it cannot be used for math without converting it back to an integer.
13th Apr 2021, 10:41 PM
Jerry Hobby
Jerry Hobby - avatar
0
So please write me the binary code of this number
13th Apr 2021, 10:46 PM
Mamad
Mamad - avatar
0
Thanks, can i have your email??
13th Apr 2021, 10:50 PM
Mamad
Mamad - avatar
0
No. You can message me here
13th Apr 2021, 10:51 PM
Jerry Hobby
Jerry Hobby - avatar
0
ok , whenever I have a question, I write here!!
13th Apr 2021, 10:53 PM
Mamad
Mamad - avatar
0
Hi, can you explain the base32 code for me ??
18th Apr 2021, 6:57 PM
Mamad
Mamad - avatar
0
Base numbering systems have a specific number of numbers per column. It’s a little crazy to get your head around at first. Base 2 means only two valid digits. 0 and 1. In order to wrote the number with a value of three, you’ll need two columns. 11 is value 3. Counting like this: 00 = 0 01 = 1 10 = 2 11 = 3 People use base 10. That means ten possible digits. 0123456789 To count above 9, you need two columns. Base 16 uses 16 possible digits. 0123456789ABCDEF Same rules , to count above 15, you need two columns. 0E = 14 0F = 15 10 = 16 11 = 17 It’s hard at first to get the feel for this. There’s a reason for these counting systems. Base 32 works the same way. You can count up to 31 using a single column, then to write 32, you need two columns. I don’t know for site what the numbering system is for base 32. I would imagine 0-9 then A-W or whatever letter. I’m not that familiar with base 32. In computers, we use binary, which is base 2. Octal, which is based 8, and hex, is base 16.
18th Apr 2021, 8:41 PM
Jerry Hobby
Jerry Hobby - avatar
0
thank you
18th Apr 2021, 11:56 PM
Mamad
Mamad - avatar
0
Mamad Did my lengthy explanation make it clear for you ? Did you need anything clarified?
20th Apr 2021, 12:54 AM
Jerry Hobby
Jerry Hobby - avatar
0
Your explanation was very helpful, thank you
20th Apr 2021, 12:56 AM
Mamad
Mamad - avatar