Conversion

ShareIn this tutorial we will learn hexadecimal to decimal conversion for a floating point number i.e., a number with fractional part.

Before we dive into the main topic lets talk a little about Decimal and Hexadecimal 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.

In hexadecimal number system we use ten digits and six english alphabet letters.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F

10 is denoted as A

11 is denoted as B

12 is denoted as C

13 is denoted as D

14 is denoted as E

15 is denoted as F

Hexadecimal implies base 16

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

ones place with 16^{0}

tens place with 16^{1}

hundreds place with 16^{2}

ans so on...

and the fractional part

tenths place by 16^{-1}

hundredths place by 16^{-2}

and so on...

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

place | ones | Decimal Point | tenths | hundredths |

hexadecimal | 0 | . | 0 | 1 |

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

`= 0x16`^{0} + 0x16^{-1} + 0x16^{-2}
= 0 + 0 + 0.00390625
= 0.00390625

So, the required decimal number is

0.01_{(base 16)} = 0.00390625_{(base 10)}

Alternatively, (0.01)_{16} = (0.00390625)_{10}

Where, (base 10) means the number is in decimal number system and (base 16) means the number is in hexadecimal number system.

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

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

hexadecimal | A | . | 2 | 8 | F | 5 | C |

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

`= Ax16`^{0} + 2x16^{-1} + 8x16^{-2} + Fx16^{-3} + 5x16^{-4} + Cx16^{-5}
= 10x16^{0} + 2x16^{-1} + 8x16^{-2} + 15x16^{-3} + 5x16^{-4} + 12x16^{-5}
= 10 + 0.125 + 0.03125 + 0.003662109375 + 0.0000762939453 + 0.0000114440918
= 10.1599...
= 10.16 (approx. value)

So, the required decimal number is

A.28F5C_{(base 16)} = 10.16_{(base 10)} (approx. value)

Alternatively, (A.28F5C)_{16} = (10.16)_{10} (approx. value)

Where, (base 10) means the number is in decimal number system and (base 16) means the number is in hexadecimal number system.

- ES6 - Template Literals (Template strings) ES6 JavaScript
- ES6 - var let const ES6 JavaScript
- How to install Apache, MySQL, PHP on macOS Catalina 10.15 How to Mac
- How to install Apache, MySQL, PHP on macOS Mojave 10.14 How to Mac
- Exercise 1 Flowchart
- How to install PostgreSQL on Mac using Homebrew How to Mac
- How to change default shell to bash on macOS Catalina How to Mac
- How to backup and restore MySQL or MariaDB database using mysqldump Reference Database
- HTML Getting Started HTML
- ChartJS | How to create Doughnut Chart using data from MySQL (MariaDB) table and PHP ChartJS