Thread: Converting 1100110.11 to base10

1. Originally Posted by brewbuck
Yes, and the original question was just a fixed-point question. The value 1100110.11 is just a Q2 fixed point value. We write down the dot to remember what the Q is. Nobody ever suggested that somewhere inside the computer there is a "dot" flying around.
Q7.2, even.

Very well, from here on I'll assume the OP was being taught how to represent numbers on systems without an FPU, and as such I'm wrong when I criticized his teacher for having shown him an inadequate representation of a modern computer.

2. Originally Posted by SlyMaelstrom
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.
You can find it insulting on behalf of quzah if you like.

According to 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."

So quzah himself states that he has no trouble interpreting the OP's question as being in base 10 to begin with. This, presumably, to try to save face in a losing argument. [flame war alert!]

I really don't see a problem if someone has not had exposure to a binary point representation of numbers. His assertion that it doesn't exist is simply wrong on that basis.

Binary point is not something supported by library functions scanf, or atoi if they include native base 2 at all. Base 10, 16, 8 only (%d, %x, %o). And then only for integers. There is no binary support except the suffix 'b' for constants I believe. Maybe some compilers only.

3. Of course...10 is the only *real* number base (in fact, all bases require as many digits, don't they?). The base-10 point is almost superfluous...

4. Originally Posted by nonoob
You can find it insulting on behalf of quzah if you like.

According to 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."

So quzah himself states that he has no trouble interpreting the OP's question as being in base 10 to begin with. This, presumably, to try to save face in a losing argument. [flame war alert!]

I really don't see a problem if someone has not had exposure to a binary point representation of numbers. His assertion that it doesn't exist is simply wrong on that basis.

Binary point is not something supported by library functions scanf, or atoi if they include native base 2 at all. Base 10, 16, 8 only (%d, %x, %o). And then only for integers. There is no binary support except the suffix 'b' for constants I believe. Maybe some compilers only.
I wasn't trying to save face, because I don't care if I'm wrong here. I'm fine that people use decimals in binary. I don't, but you can if you want to. It doesn't affect me.

I was just being pedantic. You cannot look at any arbitrary number and know what base it is. You just can't. You can't know if I mean "10" as ten or as binary, or as something else entirely in hex. We all assume that "10" is ten, because that's the base we normally use. But without them telling use what base it is, you cannot do anything more than guess. I don't care if I win whatever we're arguing about now. I'm just being pedantic - you cannot know what base he actually meant, because he didn't say what he actually meant.

Quzah.

5. Originally Posted by Sebastiani
Of course...10 is the only *real* number base (in fact, all bases require as many digits, don't they?). The base-10 point is almost superfluous...
Every base can be expressed everyway we like it to. Take hexadecimal for example:

The typical and widespread representation is: 0123456789ABCDEF

What if we used dots for every digit: 4D42 <==> 4.13.4.2

There's no actual limit. The limit is in our minds and our way of thinking, model, or beliefs

6. Originally Posted by quzah
I wasn't trying to save face, because I don't care if I'm wrong here. I'm fine that people use decimals in binary. I don't, but you can if you want to. It doesn't affect me.

I was just being pedantic. You cannot look at any arbitrary number and know what base it is. You just can't. You can't know if I mean "10" as ten or as binary, or as something else entirely in hex. We all assume that "10" is ten, because that's the base we normally use. But without them telling use what base it is, you cannot do anything more than guess. I don't care if I win whatever we're arguing about now. I'm just being pedantic - you cannot know what base he actually meant, because he didn't say what he actually meant.
I'm surprised this entire argument has even happened.

First of all, despite the fact that "10" could represent a number in essentially any base, I think it's quite easy to derive from the context of the OP's post that he was clearly wanting convert a base 2 number to a base 10 number. We're all about context here, people. Be sensible, and use it.

Second, it's also clear that any number base can represent fractions, whether it be base 2 (binary), base 3, base 10, base 11, base 26, or base 2024236. Just because we don't normally write fractions using base 2 the same way as we do base 10 doesn't mean it is an incorrect way to do it.

7. Originally Posted by Sipher
There's no actual limit. The limit is in our minds and our way of thinking, model, or beliefs
Of course there is no absolute relation between the way a number is notated and what the that number represents. But, there are established conventions, break those, and communication breaks down as well.

8. Originally Posted by Subsonics
Of course there is no absolute relation between the way a number is notated and what the that number represents. But, there are established conventions, break those, and communication breaks down as well.
I understand and totally agree with that, just like ASCII, just like any programming language! For example, it's difficult porting from Microsoft compilers to those of GNU because they have different syntax in some areas. Communication has broken down between those compilers, although there're tricks to get past them, the established and universal preprocessor! etc, etc, etc...

9. Originally Posted by Subsonics
Of course there is no absolute relation between the way a number is notated and what the that number represents. But, there are established conventions, break those, and communication breaks down as well.
You cannot argue this in the context of this thread, and allow for decimals in binary numbers. This thread appeared on the C board, which sets the context and the "established conventions". You never have a decimal place when you manipulate binary numbers in C - because it would be stupid and backwards to do so. The input would have been a string, and you would be converting from a string to a given base - in this case, base 10.

Since there are never decimal points when working with binary (bit manipulation, because you can't manipulate the bits of a floating point number directly) this number automatically defaults to being a string of base-10 numbers, in the provided context.

You cannot argue for following conventions, and have that be anything other than a base 10 number, in the context it was provided. Either your argument is wrong, or the context provided was wrong. You can't have both be right in this thread. (Yes, I'm just arguing for the sake of arguing now.)

You can't say "you only get one decimal point" (which is what you're saying), and at the same time say "yes there must be one decimal point for binary numbers", in the context it was provided (being on the C board), because nothing you ever do with binary numbers in C uses a decimal point.

Quzah.

10. Originally Posted by quzah
because nothing you ever do with binary numbers in C uses a decimal point.
Well, here I disagree, quzah. Been pretty much in agreement with you so far, but here I think you are being too intransigent. So far I've looked at this thread as some schoolboy assignment whose teacher asked him to convert a binary notation that uses a decimal point. And I completely agree this is not the correct way of teaching the handling of real numbers by modern computers. In fact, it's completely obtuse and will serve no purpose as a teaching tool.

However the notation itself exists. And can be instrumental on certain very specific cases where C is being used. And even in a direct relationship to how these numbers are stored. This is the case of systems where there's no FPU. Here, you bet it will be common practice for numbers to be represented in the Qm.f notation. They aren't stored exactly this way, but are used in this way by C. Naturally the decimal point doesn't exist. But its representation is fundamental in any specs literature about these systems, or in code comments.

Now, you and I both know this isn't the case. My last post on this thread was basically in jest. I simply know for a fact the OP wasn't being taught about systems without an FPU because if he were, the enunciate of the problem would be telling him the actual notation used. And he would be telling us that too in his question. The only possible real answer to the initial question is "What's the notation used?". We can't convert this number from Qm.f, because the actual notation could be fxm.b (*), or something else entirely. Some here assumed something akin to a decimal representation. But we simply don't know what's the notation of that representation.

Because he didn't tell us anything of that, we know for a fact this isn't about systems without an FPU. So it's safe to say that's a wrong representation for decimal numbers and it should be banished. But make no mistake you need that notation, and you'll use it when talking about (not coding) systems without an FPU.

...

(*) before anyone complains... yes, you can have 9-bit boundaries.

11. Quazah,

I'm only emphasising what Sipher said, that the relation between a sign and what is signified, is arbitrary. Then I go on to say that eventhough it's arbitrary, it's not up to individuals to make up their own, but to use established conventions. That's it. I haven't ever seen a decimal point in a binary number myself, and I'm not arguing for it's use.

12. Well since we've never heard from the OP again, and since it's been moved, and since everyone's tired of pointless debate... I'm off to make a sammich!

Quzah.

13. It really doesn't make a lick of difference how C handles bit manipulation. The OP obviously was simply asking how to write a base2 to base10 converter. It could have just as easily been how to convert fahrenheit to celcius. Would you argue that it's impossible and doesn't make sense because C doesn't know how to handle temperatures? No, the temperature, just like the base2 number the OP is trying to convert, is just an abstract entity contained in a string and you can treat it however you want, regardless of C's internal limitations.

14. From what i've read here, the real problem is that not everyone have the same opinion about what a number is! Since we can't force someone to believe what we do, lets end it here, please. ( Quoting quzah )

15. III.MCDXV
or even,
X.XXMCDXV

My gift for all you notation liberals in here. And please, don't pay attention to anyone who tries to tell you there should be some means of formal communication between programmers. We all know that is nonsense. Communication is overrated.

Popular pages Recent additions