Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# how many different numbers can six bits represent?

Posted on 2006-07-20
Medium Priority
415 Views
Does any body know how many different numbers can six bits represent?
0
Question by:amoe
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 35

Assisted Solution

Raynard7 earned 150 total points
ID: 17151116
64 (including 0)

2^6
0

Author Comment

ID: 17151402
how do i convert 7Bh to decimal?
0

LVL 5

Expert Comment

ID: 17151416
0

LVL 14

Expert Comment

ID: 17151488
Programatically?

Function HexToInt(sStr)
Dim iInt, temp, x
iInt = 0
For x = 1 To Len(sStr)
temp = Val(Mid(sStr, x, 1))
If temp = 0 And Mid(sStr, x, 1) <> "0" Then
If UCase(Mid(sStr, x, 1)) = "A" Then
temp = 10
ElseIf UCase(Mid(sStr, x, 1)) = "B" Then
temp = 11
ElseIf UCase(Mid(sStr, x, 1)) = "C" Then
temp = 12
ElseIf UCase(Mid(sStr, x, 1)) = "D" Then
temp = 13
ElseIf UCase(Mid(sStr, x, 1)) = "E" Then
temp = 14
ElseIf UCase(Mid(sStr, x, 1)) = "F" Then
temp = 15
End If
End If
temp = temp * (16 ^ (Len(sStr) - x))
iInt = iInt + temp
Next
HexToInt = iInt
End Function
0

LVL 4

Accepted Solution

v_karthik earned 150 total points
ID: 17151490
>>how do i convert 7Bh to decimal?

you mean manually? Just write down the bits representing 7 and B side by side like this

0111 1011

(note: 7 is 0111, B is 1011 or 11 in decimal)

Now read the binary in decimal (hope u know that), it becomes 123.
0

LVL 15

Expert Comment

ID: 17151542
1 bit (as a 1 or a 0)
8 bits (1 byte) = 1 character
therefore 6 bits isn't enough to represnt any characters - you need multiples of 8
0

LVL 25

Expert Comment

ID: 17153097
> therefore 6 bits isn't enough to represnt any characters

For standard character encodings, you are correct.
But if he's implementing his own format, then there's no problem (so long as he can represent those 6 bits).
0

LVL 15

Expert Comment

ID: 17153407
fair enough, is there any really good reason why this is needed (whats wrong with standard chars?)
0

LVL 25

Expert Comment

ID: 17153744
Well, if there's only a limited number of characters that need representing, then by using 6 bits instead of 8, you will be of course saving 2 bits per character.

When memory is a *major* issue, and you need to represent a very large number of characters, then this small sacrifice is somewhat significant.

But it's unlikely that you will ever be in that situation nowadays; so really, no.. I personally cannot think of any good reason why you wouldn't just stick with the standard character encodings (or at least use an 8-bit byte, which the low-level architecture directly supports; rather than trying to implement your own format).
0

LVL 15

Expert Comment

ID: 17162225
thanks - i was thinking on similar lines as you
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in aâ€¦
Introduction to Processes
###### Suggested Courses
Course of the Month4 days, 12 hours left to enroll