![]() |
![]() |
#1 (permalink) | |
The Death Card
Location: EH!?!?
|
Non negative integers
Ok I've got a practice homework question for my Hardware Design class and it states:
Quote:
|
|
![]() |
![]() |
#2 (permalink) |
Banned
Location: 'bout 2 feet from my iMac
|
whoo... ok word size is referring to the 32 and 64 bits.
binary encoding is making a non-negative int using binary. aka 0 = 32 0's 1 = 000....00001 etc. BCD is binary-coded decimal. (that's the term you'll wanna google 'cuz i don't recall exactly how it's represented). so, basically, he wants to know the range of numbers that can be encoded in 32 and 64 bits for each kind of encoding. |
![]() |
![]() |
#3 (permalink) |
Tilted
|
Well, you want to know all the different integers that can be expressed in a coding.
Binary coding should be easy. Each distinct combination of bits represents a different number. So, you've got 32 or 64 bits...how many distinct numbers can you come up with? In ASCII coding, each byte (8 bits) can represent 1 of 10 different digits. You've got 32 or 64 bits, which is 4 or 8 bytes...how many different numbers can you get? |
![]() |
![]() |
#4 (permalink) |
Junkie
Location: San Francisco
|
a. is easy.
![]() b. BCD takes a base-10 number and encodes each digit with 4 bits of binary. For example the number 328 is represented by 0011 0010 1000. With 32 bits you can fit 8 BCD digits, so you can represent 10^8 or 100000000 numbers (0-99999999). 10^16 for 64-bit words. c. Now this one is a little bit unclear. The answer varies depending on which ASCII characters you can use as digits. It also varies depending on whether you're using extended ASCII since each character is 7 bits if not and 8 bits if so. I'll assume 32-bit words and 8-bit characters for now. If you're only using the digits 0-9 for base-10, the answer is 10^4 or 10000. However, what if you're encoding hex numbers (base-16), then the answer is 16^4 because there are 16 possible digits, usually 0-9 and A-F. If you're using every ASCII character as a digit (base-256) you can represent 256^4 numbers. My guess is that you're supposed to assume you're encoding base-10. |
![]() |
Tags |
integers, negative |
|
|