Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   Non negative integers (https://thetfp.com/tfp/tilted-technology/42451-non-negative-integers.html)

Ace_O_Spades 01-21-2004 04:22 PM

Non negative integers
 
Ok I've got a practice homework question for my Hardware Design class and it states:


Quote:

These days, a typical computer word is either 32 or 64 bits long. For each word size, and for each of the following encodings, determine the number of non-negative integers that can be represented:

a. Using binary encoding
b. Using BCD encoding
c. Using ASCII encoding

i dont even know where to start, can someone point me in the right direction? Any help would be appreciated

cheerios 01-21-2004 04:27 PM

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.

magua 01-21-2004 05:04 PM

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?

n0nsensical 01-21-2004 05:12 PM

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.

Ace_O_Spades 01-21-2004 06:29 PM

wow thanks for the help guys

my actual homework is a lot harder than this, so hopefully i can get into some office hours to get some help


All times are GMT -8. The time now is 02:43 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43