# Converting 1100110.11 to base10

Show 80 post(s) from this thread on one page
Page 2 of 7 First 1234567 Last
• 01-31-2011
nonoob
No, quzah. You're falling into the same trap as the others arguing about machine representation. The OP wanted to know how to deal with the written binary number that has a fractional part. And yes, you could shift the period left or right (like dividing by 2 or multiplying by 2).

The fact that C compilers complain when you attempt a shift (<< or >>) on a floating point data type does not alter the fact that yes, one could shift the 32 or 64 bit value, but since it's a mixture of biased exponent and significand without most significant bit... it would most likely break the number. Actually it would most closely resemble a squaring or square-rooting operation.

1100110.11 is 102.75
110011.011 is 51.375 see? Yay, shifting the "decimal" works.

(My mistake, 0.11 is 0.75... I said 0.375 earlier.)
• 01-31-2011
tabstop
Oh, and has anybody figured out what we're being warned against?
• 01-31-2011
nonoob
Heh heh, good one. For a minute I thought you wanted to know what the compiler warning is for attempting to shift a floating point.
• 01-31-2011
EVOEx
For anyone wanting to argue, Wikipedia is always right and it shows examples of it:
Binary numeral system - Wikipedia, the free encyclopedia
• 01-31-2011
quzah
Quote:

Originally Posted by nonoob
No, quzah. You're falling into the same trap as the others arguing about machine representation.

No. You're falling into your own trap by saying binary is more than just 1s and 0s. It's not. Binary is just 1s and 0s. There is no "one or zero or decimal point". It's either one, or zero. That's all. There is nothing else.

Anything else is YOUR representation, which no different than you saying "you are interpreting how it's stored in memory!" There is no such thing in binary as a decimal place. It's YOU adding something more to binary. Binary is only ever 1 or 0. There's no place holder. That's you adding an extension to it.

Go read the entire first half of the Wikipedia article on it, and you'll see I'm right. There's nothing in binary that denotes a decimal point. That's an extension of binary. It's like saying your compiler supports extensions to let you use nested comments or something. That doesn't make it part of the core system, just because you extended it.

The concept of binary knows nothing of decimal places. It is simply 0s or 1s.

Quzah.
• 01-31-2011
tabstop
Quote:

Originally Posted by quzah
No. You're falling into your own trap by saying binary is more than just 1s and 0s. It's not. Binary is just 1s and 0s. There is no "one or zero or decimal point". It's either one, or zero. That's all.

If you actually believe that, then there's no decimal point in decimal, either, just zero through nine.
• 01-31-2011
anduril462
Quote:

Originally Posted by quzah
No. You're falling into your own trap by saying binary is more than just 1s and 0s. It's not. Binary is just 1s and 0s. There is no "one or zero or decimal point". It's either one, or zero. That's all. There is nothing else.

Anything else is YOUR representation, which no different than you saying "you are interpreting how it's stored in memory!" There is no such thing in binary as a decimal place. It's YOU adding something more to binary. Binary is only ever 1 or 0. There's no place holder. That's you adding an extension to it.

That's like saying numbers in base 10 are nothing more than a bunch of 0's, 1's, 2's, 3's, 4's, 5's, 6's, 7's, 8's, and 9's, with no place holder. But we obviously use our decimal number system to represent whole and fraction quantities all the time, by using an eleventh symbol, . which we also call the decimal point. It has no quantitative value in and of itself, but it does separate the whole quantity from the fractional quantity. A single digit on it's own (say 5), out of context can't represent one half of something, but you put it in the right place relative to the conventional . used for the whole-part separator, and 5 becomes .5, or one half (5 * 10^-1). Similarly, .1 in binary is 1 * 2^-1, or one half. Perhaps people are mixing up the concept of numbers vs. numerals.

Quote:

Go read the entire first half of the Wikipedia article on it, and you'll see I'm right. There's nothing in binary that denotes a decimal point. That's an extension of binary. It's like saying your compiler supports extensions to let you use nested comments or something. That doesn't make it part of the core system, just because you extended it.
Read it, still don't see how it proves you're right. As a matter of fact, the same article shows exactly how to represent non-whole numbers in base two. Same principle as in base 10 or any other base, just with powers of two instead of 10. Nobody is extending anything. What we're discussing is a number system not restricted by a computer's internal representation or some fanciful notion that a binary system can't have a whole-part separator because the symbol we would use for that is neither a 0 nor a 1.

Quote:

The concept of binary knows nothing of decimal places. It is simply 0s or 1s.
Binary by definition simply implies two-ness. In a binary, or base 2 number system, that means there are two possibilities for a digit, conventionally 0 or 1, but it could be anything. Sometimes we refer to it as high and low values or on and off. On a lower level, the computer doesn't see 0's and 1's, it sees voltage levels, like 5V or 3.3V for a value of "1". All that matters in binary is that there are two distinct values for a single digit. Just like base 10 has 10 distinct values for a digit.
• 01-31-2011
brewbuck
If you want to get all pedantic about it, there are no "ones and zeros" in a computer either. A computer is made of atoms.

When's the last time you "saw" a number? The only place that numbers, decimal points, and fractions exist is... in your head.

In any left-to-right positional number-writing system, each digit represents x*b^N, where x is a digit within that system, b is the base of the system, and N is some integer which decreases from left to right. The decimal point means "the digit to my left has N == 0". The computer doesn't care about ANY of this.
• 01-31-2011
VirtualAce
Change the title of this post please. There is no urgency here. Also read the rules about creating such titles.
• 01-31-2011
quzah
Prove it. Use strtol with a base 2 and have it handle your decimal point. Go on, show me how it's really not YOU just interpreting how you want to treat those 1s and 0s. Prove it.

There's a reason you can't treat floats as regular integer types of the same number of bits. You can't pretend you're treating it in the context of a program, and pretend you aren't at the same time. You can't try to be a purist on what binary actually means, and then try not to at the same time.

Quzah.
• 01-31-2011
brewbuck
Quote:

Originally Posted by quzah
Prove it. Use strtol with a base 2 and have it handle your decimal point. Go on, show me how it's really not YOU just interpreting how you want to treat those 1s and 0s. Prove it.

That will reveal some interesting information about what strtol() is and is not capable of, and absolutely nothing about the nature of binary numbers.
• 01-31-2011
quzah
Quote:

Originally Posted by brewbuck
That will reveal some interesting information about what strtol() is and is not capable of, and absolutely nothing about the nature of binary numbers.

Well the whole discussion really is about if you are trying to read integers, or floats. No one assumes that binary input is a floating point number, because that's a stupid way to do it.

Quzah.
• 01-31-2011
tabstop
Quote:

Originally Posted by quzah
You can't pretend you're treating it in the context of a program, and pretend you aren't at the same time.
Quzah.

Free bonus hint: You are the only person in this thread talking about a program. What was that about context, again?
• 01-31-2011
quzah
Quote:

Originally Posted by tabstop
Free bonus hint: You are the only person in this thread talking about a program. What was that about context, again?

I see. That's odd, because I'm pretty sure I'm on a C programming forum. Anyway, if we pretend this is somehow a math forum instead, and we actually look at the OP:
Quote:

how to solve this .....1100110.11 to base10?

help meee
The thing is there's nothing here in the OP that says what the source format is, so it's perfectly fine for me to say that's not binary, and that it's already base 10. Furthermore, no one I've ever talked to on a programming forum has ever taken a string of 1s and 0s, and has stuck a decimal point in the middle of it. It's a mess of a conversation. But if you want to put decimal points in your binary numbers, go ahead.

Quzah.
• 01-31-2011
tabstop
Quote:

Originally Posted by quzah
The thing is there's nothing here in the OP that says what the source format is, so it's perfectly fine for me to say that's not binary, and that it's already base 10.

That would be a perfectly wonderful response, if for no other reason that to get the OP to say what he really wants.

Quote:

Furthermore, no one I've ever talked to on a programming forum has ever taken a string of 1s and 0s, and has stuck a decimal point in the middle of it.
Quzah.
(EDIT: Okay this was originally a stupid comment. Stupid and pointless and stupid. I'm sorry.)
Show 80 post(s) from this thread on one page
Page 2 of 7 First 1234567 Last