d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Comp. Science Question > Unsigned Binary
12Next
Add Reply New Topic New Poll
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 12 2012 04:45pm
I have some questions about unsigned binary- decimal and what not.

Just a few of the questions.
An explanation of how you got the answer would be helpful too.

If you're give 5 bits how many distinct numbers can be represented if you only have 2 symbols?

Given 10 bits, what's the decimal equivalent of the smallest unsigned binary integer that can be represented?

What's the decimal equivalent of 0001 1101?

Thank you.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 12 2012 05:18pm
Quote (mcfighter @ Sep 12 2012 06:45pm)
I have some questions about unsigned binary- decimal and what not.

Just a few of the questions.
An explanation of how you got the answer would be helpful too.

If you're give 5 bits how many distinct numbers can be represented if you only have 2 symbols?

Given 10 bits, what's the decimal equivalent of the smallest unsigned binary integer that can be represented?

What's the decimal equivalent of 0001 1101?

Thank you.


you have to explain what system you're using to generate floating points. how many bits are used to represent > 1 vs < 1? IEEE has some standards, but i'm not sure you're using them.

http://en.wikipedia.org/wiki/IEEE_floating_point

you could simply writing floating points similar to how you write in decimal, with a period separating the two sections. everything to the left increases by a power of 2, everything to the right decreases by a power of 2.

eg: 11.01 = 3 + 0*(1/2) + 1*(1/4) = 3.25

the first question is easy though. there are as many distinct numbers are there are possible values. so 5 bits is from 00000 to 11111, which is 2^5 = 32
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 12 2012 05:29pm
Quote (carteblanche @ Sep 12 2012 11:18pm)
you have to explain what system you're using to generate floating points. how many bits are used to represent > 1 vs < 1? IEEE has some standards, but i'm not sure you're using them.

http://en.wikipedia.org/wiki/IEEE_floating_point

you could simply writing floating points similar to how you write in decimal, with a period separating the two sections. everything to the left increases by a power of 2, everything to the right decreases by a power of 2.

eg: 11.01 = 3 + 0*(1/2) + 1*(1/4) = 3.25

the first question is easy though. there are as many distinct numbers are there are possible values.  so 5 bits is from 00000 to 11111, which is 2^5 = 32


Thank you, not sure by what system you mean?
We are using C, and Linux if that helps.

What's the decimal equivalent of the largest unsigned binary integer that can be represented using 'n' bits?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 12 2012 05:44pm
Quote (mcfighter @ Sep 12 2012 07:29pm)
Thank you, not sure by what system you mean?
We are using C, and Linux if that helps.

What's the decimal equivalent of the largest unsigned binary integer that can be represented using 'n' bits?


I meant standard, not system sorry.

What does each digit represent? Unlike integers, there is no straightforward logical way to handle it afaik. If you have n bits, are the first x going to be the integer portion and the last n-x going to be the decimal portion? are all n bits going to be the decimal portion? is the first x digits going to be the base (assuming leading 1) and last n - x digits going to be an exponent? etc etc

iirc C does not have an unsigned floating point out of the box. their float is system dependent, though usually IEEE which is signed. you could, of course, follow IEEE's format then treat the sign bit as an additional base or exponent digit. i could be wrong but i dont think IEEE has a standard for any generic n bits, but rather very specific numbers of bits (eg 32, 64, and 128 are defined, but 37 bits is not defined)

do you handle infinity and NotANumber?

bottom line, you have to ask your teacher how he wants you to write your unsigned floating numbers.

This post was edited by carteblanche on Sep 12 2012 05:49pm
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 12 2012 05:52pm
Quote (carteblanche @ Sep 12 2012 11:44pm)
I meant standard, not system sorry.

What does each digit represent? Unlike integers, there is no straightforward logical way to handle it afaik. If you have n bits, are the first x going to be the integer portion and the last n-x going to be the decimal portion? are all n bits going to be the decimal portion? is the first x digits going to be the base (assuming leading 1) and last n - x digits going to be an exponent? etc etc

iirc C does not have an unsigned floating point out of the box. their float is system dependent, though usually IEEE which is signed. you could, of course, follow IEEE's format then treat the sign bit as an additional base or exponent digit. i could be wrong but i dont think IEEE has a standard for any generic n bits, but rather very specific numbers of bits (eg 16, 32, 64, and 128 are defined, but 37 bits is not defined)

do you handle infinity, negative infinity, and NotANumber?

bottom line, you have to ask your teacher how he wants you to write your unsigned floating numbers.


Haha, yeah i'm sorry i didn't get most of what you just said.
but, so far the only thing I do understand on here is when it asks for the unsigned binary integer equivalent of 27. Use 8 bits and pad to the left if needed. -- That would be found by dividing by 2 and what not. = 11011
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 12 2012 05:58pm
Shit, i just noticed by decimal you meant base 10. i thought you meant floating point (eg 1.234). It's been a long day :/

ok ignore everything i said before.


Quote
If you're give 5 bits how many distinct numbers can be represented if you only have 2 symbols?

actually, dont ignore this one. my answer was right.
Quote
the first question is easy though. there are as many distinct numbers are there are possible values. so 5 bits is from 00000 to 11111, which is 2^5 = 32


Quote
Given 10 bits, what's the decimal equivalent of the smallest unsigned binary integer that can be represented?

all zeros, which is zero.

Quote
What's the decimal equivalent of 0001 1101?

counting i from the right starting with i = 0, each i'th digit represents 2^i

so 0001 1101 is
0*2^7+
0*2^6+
0*2^5+
1*2^4+
1*2^3+
1*2^2+
0*2^1+
1*2^0
= 16 + 8 + 4 + 1

This post was edited by carteblanche on Sep 12 2012 06:01pm
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 12 2012 06:18pm
Quote (carteblanche @ Sep 12 2012 11:58pm)
Shit, i just noticed by decimal you meant base 10. i thought you meant floating point (eg 1.234). It's been a long day :/

ok ignore everything i said before.



actually, dont ignore this one. my answer was right.



all zeros, which is zero.


counting i from the right starting with i = 0, each i'th digit represents 2^i

so 0001 1101 is
0*2^7+
0*2^6+
0*2^5+
1*2^4+
1*2^3+
1*2^2+
0*2^1+
1*2^0
= 16 + 8 + 4 + 1


Quote (carteblanche @ Sep 12 2012 11:58pm)
Shit, i just noticed by decimal you meant base 10. i thought you meant floating point (eg 1.234). It's been a long day :/

ok ignore everything i said before.



actually, dont ignore this one. my answer was right.



all zeros, which is zero.


counting i from the right starting with i = 0, each i'th digit represents 2^i

so 0001 1101 is
0*2^7+
0*2^6+
0*2^5+
1*2^4+
1*2^3+
1*2^2+
0*2^1+
1*2^0
= 16 + 8 + 4 + 1


haha ok thanks
how about what is the decimal equivalent of the largest unsigned binary integer that can be represented using 10 bits?

Assume that a machine has only 4 bits to store unsigned binary integers. Assume that the value of 3 is added to the value of 15. What number would be stored into memory? = (would this be 18?)

The unsigned binary number 111 011 100 111 010 is represented using a binary notation. What is the octal equivalent of this unsigned binary number?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 12 2012 07:04pm
you can answer #1 based on the info i gave you.
for #2, it becomes overflowed and wraps around.
for #3, convert each triplet to a number from 0-7 using the same strategy i already gave you.
Member
Posts: 11,637
Joined: Feb 2 2004
Gold: 434.84
Sep 13 2012 07:37am
You aren't even trying to help yourself with your homework questions.
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 13 2012 11:34am
Quote (rockonkenshin @ Sep 13 2012 01:37pm)
You aren't even trying to help yourself with your homework questions.


I am, I'm just completely confused as to how to even go about doing any of it.
Thank you for your help carteblanche.
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll