Binary 2 Decimal


E-mail this post



Remember me (?)



All personal information that you provide here will be governed by the Privacy Policy of Blogger.com. More...



Number we want to transform uses base X: we would like to transform this number into new one, that uses Y base. In this case we will use method of continuous dividing and multiplying (dividing numbers left of comma (,) with Y and multiplying numbers on the right side of comma, by Y - rational numbers). This method is best understood looking at these examples, where X = 2, and Y = 10 (binary and decimal base, B1=2, B2=10):


Binary System:

Base: 2
Digits: 0, 1
Example: 27 (decimal) = 11011 2 (binary)


Decimal System:

Base: 10
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9



Binary 2 Decimal




Example

Transform 110101 (binary) into decimal number


110101 2 = 1*25 + 1*24 + 0*23 + 1*22 + 0*21 + 1*20
= 1*25 + 1*24 + 1*22 + 1*20

= 1*32 + 1*16 + 1*4 + 1*1

=
53 10




Example

Transform -11,101 (binary) into decimal number


-11,101 2 = - (1*21 + 1*20 + 1*2-1 + 0*2-2 + 1*2-3)
= - (1*21 + 1*20 + 1*2-1 + 1*2-3)

= - (1*2 + 1*1 + 1*0,5 + 1*0,125)

=
- 3 , 625





Technorati Tags: , , , , , , , , , , ,



1 Responses to “Binary 2 Decimal”

  1. Anonymous Roi 

    nice work, but i dont see the code..most of us knows math, but not programming..can u give us the codes too?

Leave a Reply

      Convert to boldConvert to italicConvert to link

 


German Flag Spanish Flag French Flag Italian Flag Portuguese Flag Japanese Flag Korean Flag Chinese Flag British Flag


This Website is optimized for Firefox. Users browsing with Internet Explorer may encounter problems while viewing pages.


C++ Maniac



Learn C



Additional



#include



Learn Converting



Appendix


Links


Previous posts




Daily Lessons for programming in Visual Studio, using C code.