LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2006, 09:39 PM   #1
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Rep: Reputation: 30
6-bit Unsigned Number


Whats the biggest number you can fit in a 6-bit unsigned number?

Is it:
32+16+8+4+2+1=63 ?
 
Old 09-25-2006, 09:57 PM   #2
pankaj99
Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 47

Rep: Reputation: 15
--------------------------------------------------------------
yes

Last edited by pankaj99; 09-25-2006 at 09:59 PM.
 
Old 09-26-2006, 07:58 AM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by ckoniecny
Whats the biggest number you can fit in a 6-bit unsigned number?

Is it:
32+16+8+4+2+1=63 ?
This is correct, but there will become a time when you run out of paper lol

b = bits,n = number;

n = 2^b -1
 
Old 09-26-2006, 08:47 AM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
And, for the record, for signed values:
Code:
max=2^bits-1
min=-(2^bits)
 
Old 09-26-2006, 08:56 AM   #5
pankaj99
Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 47

Rep: Reputation: 15
Quote:
Originally Posted by Matir
And, for the record, for signed values:
Code:
max=2^bits-1
min=-(2^bits)
for signed numbers it should be
max=2^(bits-1) - 1
min=-( 2^(bits-1) )
 
Old 09-26-2006, 09:47 AM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by pankaj99
for signed numbers it should be
max=2^(bits-1) - 1
min=-( 2^(bits-1) )
I stand corrected. My apologies, left out the -1.

Last edited by Matir; 09-26-2006 at 09:49 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
printing 64 bit hex number lilzz Linux - Newbie 8 08-20-2006 08:16 PM
Adding Unsigned Integers of 128 bit bluechicken Programming 1 06-27-2005 02:27 PM
convert unsigned char * to unsigned long int linux_lover2005 Programming 3 04-26-2005 11:38 PM
64 bit CPU unsigned long int GodSendDeath Programming 8 03-29-2005 01:19 PM
Good distro for 64-bit number munching + desktopping? Entropius Linux - Distributions 3 09-08-2004 12:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration