In this tutorial we will learn to convert a decimal number having fractional part into hexadecimal number.

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 decimal number having fractional part into hexadecimal we first convert the integer part into hexadecimal form and then fractional part into hexadecimal form. And finally we combine the two results to get the final answer.

Convert decimal number 0.00390625 into hexadecimal form.

The given decimal number has 0 as integer part and .00390625 as fractinoal part.

We first convert the integer part 0 in hex (hexadecimal) form.

```
Step 1
----------------
Dividend = 0
As, dividend is less than 16 so, we will stop here and copy it as the only remainder.
So, 1st remaider = 0
```

The calculated remainder are as followed.

1st remainder = 0

To find the hexadecimal we have to scan the remainder from bottom.

So, 0_{(base 10)} = 0_{(base 16)}

Alternatively, (0)_{10} = (0)_{16}

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

Now we will convert the fractional part .00390625 into hex (hexadecimal) form.

```
Hexadecimal of 0.00390625
Step 1
----------
We multiply 0.00390625 by 16 and take the integer part
0.00390625 x 16 = 0.0625
Integer part = 0
Fractional part = 0.0625
As, fractional part is not equal to 0 so we copy it to next step.
Step 2
----------
We multiply 0.0625 by 16 and take the integer part
0.0625 x 16 = 1.000
Integer part = 1
Fractional part = 0
Now the fractional part is 0 so, we stop here.
```

The calculated integer part are as followed.

Step 1: 0

Step 2: 1

To find the hexadecimal we have to scan the integer part from top

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

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

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

Now, to get the hexadecimal of the decimal number 0.00390625 we have to merge the two results.

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

Convert decimal number 10.16 into hexadecimal form.

First we convert the integer part 10 into hexadecimal.

```
Step 1
----------------
Dividend = 10
As, dividend is less than 16 so, we will stop here and copy it as the only remainder.
So, 1st remaider = 10 = A in hex.
```

The calculated remainder are as followed.

1st remainder = 10 = A

To find the hexadecimal we have to scan the remainder from bottom.

So, 10_{(base 10)} = A_{(base 16)}

Alternatively, (10)_{10} = (A)_{16}

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

Now, we will convert the fractional part 0.16 into hexadecimal.

```
Hexadecimal of 0.16
Step 1
----------
We multiply 0.16 by 16 and take the integer part
0.16 x 16 = 2.56
Integer part = 2
Fractional part = 0.56
As, fractional part is not equal to 0 so we copy it to next step.
Step 2
----------
We multiply 0.56 by 16 and take the integer part
0.56 x 16 = 8.96
Integer part = 8
Fractional part = 0.96
As, fractional part is not equal to 0 so we copy it to next step.
Step 3
----------
We multiply 0.96 by 16 and take the integer part
0.96 x 16 = 15.36
Integer part = 15 = F in hex form
Fractional part = 0.36
As, fractional part is not equal to 0 so we copy it to next step.
Step 4
----------
We multiply 0.36 by 16 and take the integer part
0.76 x 16 = 5.76
Integer part = 5
Fractional part = 0.76
As, fractional part is not equal to 0 so we copy it to next step.
Step 5
----------
We multiply 0.76 by 16 and take the integer part
0.76 x 16 = 12.16
Integer part = 12 = C in hex form
Fractional part = 0.16
As, fractional part is not equal to 0 so we copy it to next step.
Step 6
----------
We multiply 0.16 by 16 and take the integer part
0.16 x 16 ...
in this case, we have 5 digits as answer and the fractional part is still not 0 so, we stop here.
```

The calculated integer part are as followed.

Step 1: 2

Step 2: 8

Step 3: F

Step 4: 5

Step 5: C

...

To find the hexadecimal we have to scan the integer part from top

So, 0.16_{(base 10)} = 0.28F5C..._{(base 16)}

Alternatively, (0.16)_{10} = (0.28F5C...)_{16}

Or, (0.16)_{10} = (0.28F5C)_{16} (approx. value)

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

Now, to get the hexadecimal of the decimal number 10.16 we have to merge the two hexadecimal results.

(10)_{10} = (A)_{16}

(0.16)_{10} = (0.28F5C...)_{16}

So, (10.16)_{10} = (A.28F5C...)_{16}

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

Recently Added

- JS Event Handlers JavaScript
- JS Conditional Statement - Switch JavaScript
- JS Conditional Statement - If Else JavaScript
- JS Objects JavaScript
- JS Functions JavaScript
- JS Logical Operators JavaScript
- JS Comparison Operators JavaScript
- JS Assignment Operator JavaScript
- Bootstrap - Responsive Embed and Wells Bootstrap
- Bootstrap - Breadcrumbs, Jumbotron and Page Header Bootstrap