Conversion

ShareIn this tutorial we will learn binary to decimal conversion for a number with fractional part.

Before we dive into the main topic lets talk a little about Decimal and Binary Number System that we are going to work with in this tutorial.

A decimal number system consists of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. So, any number that we use in our daily life is actually in decimal number system.

A binary number system consists of only 2 digits: 0 and 1. And it is most commmonly used in computers.

To convert a binary number having fractional part into decimal form we have to multiply the

tenths position by 2^{-1}

hundredths position by 2^{-2}

and so onâ€¦

The following table shows the places, binary number and the multipliers for the corresponding places.

place | ones | Decimal Point | tenths | hundredths | thousandths |

binary | 0 | . | 0 | 0 | 1 |

multiplier | 2^{0} | 2^{-1} | 2^{-2} | 2^{-3} |

`= 0x2`^{0} + 0x2^{-1} + 0x2^{-2} + 1x2^{-3}
= 0 + 0 + 0 + 0.125
= 0.125

So, the required decimal number is

0.001_{(base 2)} = 0.125_{(base 10)}

Alternatively, (0.001)_{2} = (0.125)_{10}

Where, (base 10) means the number is in decimal number system and (base 2) means the number is in binary number system.

To convert a binary number having integer and fractional part into decimal form we have to multiply the integer part

ones place with 2^{0}

tens place with 2^{1}

hundreds place with 2^{2}

ans so on...

and the fractional part

tenths position by 2^{-1}

hundredths position by 2^{-2}

and so on...

The following table shows the places, binary number and the multipliers for the corresponding places.

place | thousands | hundreds | tens | ones | Decimal Point | tenths | hundredths | thousandths | ten thousandths | hundred thousandths |

binary | 1 | 0 | 1 | 0 | . | 0 | 0 | 1 | 0 | 1 |

multiplier | 2^{3} | 2^{2} | 2^{1} | 2^{0} | 2^{-1} | 2^{-2} | 2^{-3} | 2^{-4} | 2^{-5} |

`= 1x2`^{3} + 0x2^{2} + 1x2^{1} + 0x2^{0} + 0x2^{-1} + 0x2^{-2} + 1x2^{-3} + 0x2^{-4} + 1x2^{-5}
= 8 + 0 + 2 + 0 + 0 + 0 + 0.125 + 0 + 0.03125
= 10.15625

So, the required decimal number is

1010.00101_{(base 2)} = 10.15625_{(base 10)}

Alternatively, (1010.00101)_{2} = (10.15625)_{10}

or, (1010.00101)_{2} = (10.16)_{10} (approx. value)

Where, (base 10) means the number is in decimal number system and (base 2) means the number is in binary number system.

- Node.js - Event Emitter Node.js
- Node.js - How to write file in Node.js using fs module Node.js
- Node.js - How to read file in Node.js using fs module Node.js
- ES6 - Arrow Function ES6 JavaScript
- PostgreSQL - ALTER Table PostgreSQL
- PostgreSQL - DROP Table PostgreSQL
- PostgreSQL - Database PostgreSQL
- PostgreSQL - CREATE Table PostgreSQL
- PostgreSQL - Data Types PostgreSQL
- Design Patterns - JavaScript - Classes and Objects Design Patterns