0
62 in ASCII
Our teacher sent us a pdf and it says that 62 on base 10 is equal to 0011 0110 0011 0010 according to ASCII character set ( idk if he refers to that ASCII we know of or something else ) and in BCD it is 0110 0010, I got the BCD one but I couldn't figure out how that ascii one is encoded, is it correct, if so how does it work?
6 odpowiedzi
+ 3
it could be because 62 is treated as a String because:
0011 0110 = ascii for 6
and
0011 0010 = ascii for 2
so combined they are 0011 0110 0011 0010 which is 62, 6 next to 2 not the int 62.
+ 2
Mustafa K. You can give him this recomandation:
62 in binary is...
62 in unpacked BCD is...
62 in packed BCD is...
"62" ASCII in unpacked BCD is...
"62" ASCII in packed BCD is...
PS: In Romania, we have an expression about Turkish, confirming your "... one thing can mean a lot..."
In case of Romanian language, we have a lot of words, which can be different in each geographic region, but as a language, there are a lot of words. We have language influences from latin, slavic, turkish, germanic and maybe more.
+ 1
Romeo Cojocaru as it seems the way he explained things on pdf leads to some misunderstandings like saying 62 on base 10 for both number and "62", a string, if he were to say like "62" in ascii is this and 62 on base 10 is that, then it'd be okay, especially in Turkish where one thing can mean a lot it's sometimes difficult to understand even for natives.
0
Are you sure that 62 is 0110 0010 on 8 bits (byte)?
MSB is sign bit, so you have values from -128 to 127. If MSB is not sign bit, you have values fro 0 to 255...
Anyway, 0110 0010 is not 62. But,
0011 1110 is 62.
While that binary number on 16 bits is definitely not 62, but maybe your teacher knows things that I don't know. 😉
0
Romeo Cojocaru that 0110 0010 is encoded using BCD meaning every 4 bit represents every digit of the number so you calculate these 4 bits seperately and its correct but the problem is with the ascii one
0
Mustafa K.
In byte-oriented systems (i.e. most modern computers), the term unpacked BCD[1] usually implies a full byte for each digit (often including a sign), whereas packed BCD typically encodes two digits within a single byte by taking advantage of the fact that four bits are enough to represent the range 0 to 9. The precise 4-bit encoding, however, may vary for technical reasons (e.g. Excess-3).
https://en.m.wikipedia.org/wiki/Binary-coded_decimal
So, it's like Bahha🐧 said. In ASCII table you see the decimal value for each char: 50 for "2" and 54 for "6". Then, convert in binary 54 and 50 on 8 bits (as unpacked BCD).