# Thread: Converting 1100110.11 to base10

1. I can't really see what any fuss is about.

If the OP asks for convert "1100110.11" to base 10 then seeing as how he has placed a decimal point there, he has clearly chosen to treat the bits to the right of it as fractional places.

The answer of how to convert it is to treat each digit position as a power of two, assuming it is binary originally, and then sum them all up.

For a number where the digits are ...ABCDEFG.HI..., the answer is:
... A*2^6 + B*2^5 + C*2^4 + D*2^3 + E*2^2 + F*2^1 + G*2^0 + H*2^-1 + I*2^-2 ...
(where ^ denotes the power function)

2. quzah, it is clear you have had no formal education in number systems. Perhaps all of your exposure to base 2 has been only within the context of what C library functions provide.

Number systems of any base can represent whole numbers and fractions. I can look for many examples where the "decimal point" is indeed included in definitions of systems other than base-10.

In this description for example:
Binary Number System

"Numbers can be placed to the left or right of the point, to indicate values greater than one or less than one. The number to the left of the decimal point is a whole number (10 for example). As we move further left, every number place gets 2 times bigger. The first digit on the right means halves (1/2). As we move further right, every number place gets 2 times smaller (half as big)."

But back to the Wiki article, it calls the period a "binary point". "Binary numbers can also be multiplied with bits after a binary point:..." and then gives an example of long-hand multiplication by doing 5.625 x 6.25 in binary.

3. I believe iMalc** and others who support decimal points and digits to the right side of that decimal point are quite right. That is the standard for base 10. Other bases are no different in that respect.

I believe Quzah is also correct, from a usage point of view. I've never heard of base 2 numbers which included a decimal point. Yes, it could happen, but experience says it's not likely to happen. We simply don't think of numbers less than one, in a base 2 format.

When I first saw that decimal point in the binary number, I thought it was a speck of dirt on my monitor.

I'd prefer not having these "evaluations" of what kind of education other forum members have, posted. It has the effect of directing the topic away from the subject, and into personal matters.

**Excellent post on this, iMalc.

4. 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 agree. I am moving this thread to General Discussions as what minimal context was provided makes it seem much more of a maths question than a C programming question.

hakimstm1b, if this is really supposed to be a C programming problem, then please start a new thread in the C programming problem with a better description of your problem along with your best attempt to solve it.

5. Originally Posted by nonoob
quzah, it is clear you have had no formal education in number systems. Perhaps all of your exposure to base 2 has been only within the context of what C library functions provide.
This is true. I have only ever used them to manipulate bits.
Originally Posted by iMalc
I can't really see what any fuss is about.

If the OP asks for convert "1100110.11" to base 10 then seeing as how he has placed a decimal point there, he has clearly chosen to treat the bits to the right of it as fractional places.
The problem is that you cannot assume a number that only consists of 1s and 0s is binary (since all you are is seeing it as a string here).

What's this number?

101

Or this number:

10

If you said one hundred one, and ten, then you might have been right. Of course you just as easily could have been wrong too. Especially if my post had started with "What's this number?" and ended at "10".

Quzah.

6. O_O

Okay, despite the fact that I know this stuff, it must be said: a thank you to tabstop, iMalc, nonoob, and anduril462.

Soma

7. Originally Posted by quzah
No there aren't. That's why you can't use shift operators on a float.
All bases can be treated equally. Mathematically no bases have any "special privileges". Therefore, nonoob is right.

8. Originally Posted by maxorator
All bases can be treated equally. Mathematically no bases have any "special privileges". Therefore, nonoob is right.
Not in C they aren't, which is where this thread was initially posted.

Quzah.

I'd prefer not having these "evaluations" of what kind of education other forum members have, posted. It has the effect of directing the topic away from the subject, and into personal matters.
No disrespect intended. And I don't think quzah ever took it to be insulting. No 'formal' education simply means not having gone through a classroom setting in mathematical theory. Instead, having not encountered a "binary point" is simply a reflection of what is encountered in day-to-day practical C programming.

Quite right, the OP did not specify the incoming number base, although it is implied it is NOT base 10 as that was the desired target. Base 2 was assumed but probably safely so.

10. Not overly excited by seeing a floating point sign in a binary representation myself. I'd rather preferred if the OP teacher had explained to him the IEEE 754 binary representation and he was now asking us about such a datum.

For all purposes this bit representation with a floating point sign is entirely useless and will teach him nothing.

11. Originally Posted by Mario F.
For all purposes this bit representation with a floating point sign is entirely useless and will teach him nothing.
It will teach him to represent any arbitrary number in any arbitrary base. It might not have any direct practical application to programming or computer science, but I think learning to generalize a concept leads to a better overall understanding of it.

12. I tend to agree with NeonBlack.

Teaching that base 10 is a myopic way to look at the world will open up your mind to issues of scaling, precision, input/output conversions, logarithms, round off error, etc. If the student becomes comfortable with how a digit's position determines exponent, then they are ready to write programs that can do any base conversions, to and from base 10.

Understanding how a binary point works will make it simple to understand IEEE 754's exponent field.

I don't think starting with IEEE 754 format would make generalization of the math involved easier.

13. Originally Posted by nonoob
I don't think starting with IEEE 754 format would make generalization of the math involved easier.
I don't see how this format will make it easier. It offers no shortcut that I can see. No new information that isn't already available through traditional base 10 representation. It's not because I put a floating point in a binary representation that suddenly one has an eureka moment. What's worse, the conversion technique is a gimmick that simply inverts the technique used for the integral part. It does not provide any new knowledge and the whole thing will have to be relearned when it comes the time one really has to understand floating point binary representation in a computer.

I entirely fail to see the value of this. It cannot be applied in any way. So it fails as a generalization. A generalization would save important knowledge when it came the time to get into the specifics. But this representation saves instead the wrong knowledge. In other words, what he learned here cannot be applied to what he will have to learn later.

Binary representation of floating point numbers differs greatly from binary representation of integer numbers. It has in fact... surprise... a lot more in common with decimal representation of floating point numbers. If you want a good generalization, there you have it. It's a lot easier to make a student understand floating-point representation in binary format by showing them this simple decimal representation, and starting from there:

314.1592 X 10^-2

Pretty much everything they need to know is represented here.

14. Originally Posted by NeonBlack
It will teach him to represent any arbitrary number in any arbitrary base. It might not have any direct practical application to programming or computer science, but I think learning to generalize a concept leads to a better overall understanding of it.
While that might be what you're comfortable with, it's simply not how this forum, or most forums for that matter, have historically worked. Topics are answered with in the context of the forum. If someone were to post a question about history or literature in the C programming forum, then perhaps you might not feel comfortable answering it because you identify that it is not related to programming. This is no different... the fact is that you and many others here simply seem to feel that math is "close enough" to programming to answer in a programming forum, which is not correct. It's not a programming question, and in my opinion, the most valid answer would be to instruct to the OP that his/her question structure does not agree with the subject matter of this forum and that the question should be either rephrased to fit the subject matter or directed to another location. Something I feel confident Quzah would have said had he responded to this thread before anyone else.

While there is no obligation, there certainly is an expectation to respect the environment of the forum and to both ask and answer questions with full regards to that environment. This is to ensure that the subjects presented don't confuse people who are not as familiar with the subject or subjects presented as you or Quzah certainly are. Try and tell me that if this thread went on answering the question with respects to number systems rather than programming that some first level CS student wouldn't think that perhaps a significant amount of modern computers might store floating point data in that format.

By the way... I find it tremendously insulting for people to suggest that Quzah or anyone that has been on this forum as long a him could read 1100110.11 and wouldn't comprehend what is being implied by the OP. You don't need "formal education in number systems" to know what is being said there... but the very fact that you're talking about number systems in a C forum is exactly what I, and Quzah, and a few others have an issue with.

15. Originally Posted by Mario F.
Not overly excited by seeing a floating point sign in a binary representation myself. I'd rather preferred if the OP teacher had explained to him the IEEE 754 binary representation and he was now asking us about such a datum.
And how is our student going to get through learning about IEEE754 without dealing with a floating point sign in a binary representation? That's what the mantissa of a IEEE754 float is, after all. (EDIT: What am I saying? The mantissa is fixed point. Still has a (binary/radix) point, though.)