Warning: Illegal string offset 'html' in /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php on line 909

Any body there? - HSN forum

# Any body there?

5 replies to this topic

### #1charles

Showing Improvement

• Members
• 10 posts
• Gender:Male

Posted 27 May 2006 - 11:02 AM

What are the range of positive and negative integers that can be stored using:

a) 8 bits
b) n bits

### #2Dave

Ruler (but not owner) of hsn

• Moderators
• 4,252 posts
• Location:kilmarnock(ok kilmaurs)
• Interests:programming, exercising, brass band, using this board
• Gender:Male

Posted 27 May 2006 - 11:32 AM

the number of discrete integers that can be stored with 8 bits is obviously 2^8 however when we have negative numbers then we need to share that 2^8 bank over both negative and positive numbers. there is a general equation but i dont think you will need to learn it as the understanding of it is quite simple. The general equation is:

range =

-(2n-1-1) to (2n-1-1)

can you think of a reason why we subtract the ones

If i am not here i am somewhere else

### #3Pammy

Site Swot

• Members
• 194 posts
• Location:Glasgow(ish)
• Interests:Swimming, music (listening and playin), goin to the flicks, shopping &lt;3, shoes, glitter, reading, flowers, msn, bowling for soup, westlife, bags and nailpolish
• Gender:Female

Posted 27 May 2006 - 11:49 AM

Something to do with the 0 isn't it ??
*~* Kiss me, beneath the milky twilight, lead me, out on the moonlit floor, lift your open hand, strike up the band and make the fireflies dance, silver moon sparkling, so kiss me *~*

### #4Dave

Ruler (but not owner) of hsn

• Moderators
• 4,252 posts
• Location:kilmarnock(ok kilmaurs)
• Interests:programming, exercising, brass band, using this board
• Gender:Male

Posted 27 May 2006 - 12:21 PM

yeh there is a zero which is in the middle which needs to be taken into account. more importantly zero can be represented in 2 ways which is why u take 1 from both the negative and positive numbers. In two's complement you only take one from the positive side as is shown below

If i am not here i am somewhere else

### #5charles

Showing Improvement

• Members
• 10 posts
• Gender:Male

Posted 27 May 2006 - 01:36 PM

QUOTE(charles @ May 27 2006, 12:02 PM)

What are the range of positive and negative integers that can be stored using:

a) 8 bits
b) n bits

How about using two's component reprensent it?

a) 0000 0000-1111 1111 It positive, how about negative?

Thanx

### #6Dave

Ruler (but not owner) of hsn

• Moderators
• 4,252 posts
• Location:kilmarnock(ok kilmaurs)
• Interests:programming, exercising, brass band, using this board
• Gender:Male

Posted 27 May 2006 - 01:44 PM

in two's complement the range is -2n-1 to 2n-1-1

If i am not here i am somewhere else

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users