How to Convert a Binary Number to 6 Significant figures

In summary: I was looking for.In summary, rounding a binary number to 6 significant figures and 12 significant figures is different, and the rounding rule for base 2 is to truncate and add one to the last bit.
  • #1
Dada
10
1
1203.201 which is 0100|1011|0011.0011|0011

How to round the binary representation to 6 significant figures and 12 significant figures? And what is the rounding rule for base 2?

If it was rounded to 6 significant figure, such as 0100|10 {2}, then it changes its initial value, doesn't it?

So, what am I supposed to?

Thank You!
 
Physics news on Phys.org
  • #2
Well, if you mean round the binary to 6 significant figures (which are bits in binary), I think you get

010011000000

but I assume that's not what you mean. SO ... if you mean to do the rounding in decimal then DO it in decimal (1203.20) and re-convert to binary. Rounding in decimal and rounding in binary just aren't going to be the same because binary has about 3 times the granularity of decimal.
 
  • Like
Likes Klystron, scottdave and Dada
  • #3
Thank you, phinds! You solved my doubt! I actually meant the first situation you explained since I was confused whether I should add 0's at the end of the 6th digit. And it is great that you provided me a second situation!
 
  • #4
The real rounding should be in the base chosen. For base 2, then you'd decide based on the digit to the right.

.000010 --> rounds to .00001 (ie we just truncate and drop the 0 bit)

and

.000011 --> rounds to .00001+.00001 --> .00010 (ie we truncate and add one to the last bit)

Converting back to decimal means you are rounding in a decimal sense.
 
  • Like
Likes Dada
  • #5
jedishrfu said:
The real rounding should be in the base chosen. For base 2, then you'd decide based on the digit to the right.

.000010 --> rounds to .00001 (ie we just truncate and drop the 0 bit)

and

.000011 --> rounds to .00001+.00001 --> .00010 (ie we truncate and add one to the last bit)

Converting back to decimal means you are rounding in a decimal sense.

Thank you for clearing my question about rounding rule and explaining so clear, jedishrfu!
 
  • #6
jedishrfu said:
Converting back to decimal means you are rounding in a decimal sense.
I disagree that rounding something in binary and then converting it to decimal is "rounding in the decimal sense" because as I pointed out (and I'm sure you realize) binary and decimal do not have the same granularity.
 
  • Like
Likes jedishrfu
  • #7
Dada said:
... I was confused whether I should add 0's at the end of the 6th digit.
I hope when you round numbers in any base you add the necessary zeros.
If you round 299 792 458 m/sec to 6 sig fig, I hope it doesn't become 299 792 m/sec
 
  • Haha
Likes Dada and phinds
  • #8
Merlin3189 said:
I hope when you round numbers in any base you add the necessary zeros.
If you round 299 792 458 m/sec to 6 sig fig, I hope it doesn't become 299 792 m/sec
Thank you for your reminder, Merlin3189!
 
  • #9
phinds said:
I disagree that rounding something in binary and then converting it to decimal is "rounding in the decimal sense" because as I pointed out (and I'm sure you realize) binary and decimal do not have the same granularity.
I was responding with a clarification to your earlier excellent post. So that the OP wouldn’t think that binary rounding meant converting a binary representation back to decimal to do the rounding and then back to binary.
 
  • Like
Likes phinds
  • #10
jedishrfu said:
I was responding with a clarification to your earlier excellent post. So that the OP wouldn’t think that binary rounding meant converting a binary representation back to decimal to do the rounding and then back to binary.
Ah. I misunderstood. Thanks for that clarification.
 
  • #11
I'm not sure what people found so funny about my comment? It was meant to be serious.
Not so much a reminder, as an illustration of why it has to be so.

The thing that puzzled me for a while about the OP was, why rounding to 6 figs should be any different from rounding to 12 figs.
 
  • #12
I think it was a great comment. It clarified that the digits don't go away ie the number as a whole doesn't get reduced by a factor of a million.

123,456,123,456 = would round to 123,456,000,000 and not 123,456

I think in scientific notation you wouldn't have noticed this:

123,456,123,456 = 1.23456123456 E12 = 1.23456 E12 rounded
 
Last edited:
  • #13
Merlin3189 said:
I'm not sure what people found so funny about my comment? It was meant to be serious.
Not so much a reminder, as an illustration of why it has to be so.

The thing that puzzled me for a while about the OP was, why rounding to 6 figs should be any different from rounding to 12 figs.
Personally, I didn't doubt for a minute that you were serious but I just found it humorous that someone would need to be reminded of that.
 
  • Like
Likes jedishrfu
  • #14
Merlin3189 said:
I'm not sure what people found so funny about my comment? It was meant to be serious.
Not so much a reminder, as an illustration of why it has to be so.

The thing that puzzled me for a while about the OP was, why rounding to 6 figs should be any different from rounding to 12 figs.
Thank you for your clarification, Merlin3189! I am sorry that I used the unappropriated wording!

This question comes from my textbook, so when I copied it, I mistakenly included the 12 figs question.
 
Last edited:

Similar threads

Replies
11
Views
1K
Replies
2
Views
2K
Replies
6
Views
1K
Replies
8
Views
1K
Replies
2
Views
1K
Replies
3
Views
15K
Back
Top