Conversion

ShareIn this tutorial we will learn to convert a decimal number having fractional part into octal number.

Before we dive into the main topic lets talk a little about Decimal and Octal 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 Octal number system we use eight digits.

0, 1, 2, 3, 4, 5, 6 and 7

Octal implies base 8

To convert a decimal number having fractional part into octal we first convert the integer part into octal form and then fractional part into octal form. And finally we combine the two results to get the final answer.

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

We first convert the integer part 0 in octal form.

```
Step 1
----------------
Dividend = 0
As, dividend is less than 8 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 octal we have to scan the remainder from bottom.

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

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

Where, (base 10) means the number is in decimal number system and (base 8) means the number is in octal number system.

Now we will convert the fractional part .015625 into octal form.

```
Octal of 0.015625
Step 1
----------
We multiply 0.015625 by 8 and take the integer part
0.015625 x 8 = 0.125
Integer part = 0
Fractional part = 0.125
As, fractional part is not equal to 0 so we copy it to next step.
Step 2
----------
We multiply 0.125 by 8 and take the integer part
0.125 x 8 = 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 octal we have to scan the integer part from top

So, 0.015625_{(base 10)} = 0.01_{(base 8)}

Alternatively, (0.015625)_{10} = (0.01)_{8}

Where, (base 10) means the number is in decimal number system and (base 8) means the number is in octal number system.

Now, to get the octal of the decimal number 0.015625 we have to merge the two results.

(0.015625)_{10} = (0.01)_{8}

First we convert the integer part 7 into octal.

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

The calculated remainder are as followed.

1st remainder = 7

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

So, 7_{(base 10)} = 7_{(base 8)}

Alternatively, (7)_{10} = (7)_{8}

Where, (base 10) means the number is in decimal number system and (base 8) means the number is in octal number system.

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

```
Octal of 0.16
Step 1
----------
We multiply 0.16 by 8 and take the integer part
0.16 x 8 = 1.28
Integer part = 1
Fractional part = 0.28
As, fractional part is not equal to 0 so we copy it to next step.
Step 2
----------
We multiply 0.28 by 8 and take the integer part
0.28 x 8 = 2.24
Integer part = 2
Fractional part = 0.24
As, fractional part is not equal to 0 so we copy it to next step.
Step 3
----------
We multiply 0.24 by 8 and take the integer part
0.24 x 8 = 1.92
Integer part = 1
Fractional part = 0.92
As, fractional part is not equal to 0 so we copy it to next step.
Step 4
----------
We multiply 0.92 by 8 and take the integer part
0.92 x 8 = 7.36
Integer part = 7
Fractional part = 0.36
As, fractional part is not equal to 0 so we copy it to next step.
Step 5
----------
We multiply 0.36 by 8 and take the integer part
0.36 x 8 = 2.88
Integer part = 2
Fractional part = 0.88
As, fractional part is not equal to 0 so we copy it to next step.
Step 6
----------
We multiply 0.88 by 8 and take the integer part
0.88 x 8 ...
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: 1

Step 2: 2

Step 3: 1

Step 4: 7

Step 5: 2

...

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

So, 0.16_{(base 10)} = 0.12172..._{(base 8)}

Alternatively, (0.16)_{10} = (0.12172...)_{8}

Or, (0.16)_{10} = (0.12172)_{8} (approx. value)

Where, (base 10) means the number is in decimal number system and (base 8) means the number is in octal number system.

Now, to get the octal of the decimal number 7.16 we have to merge the two octal results.

(7)_{10} = (7)_{8}

(0.16)_{10} = (0.12172...)_{8}

So, (7.16)_{10} = (7.12172...)_{8}

or, (7.16)_{10} = (7.12172)_{8} (approx. value)

- 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
- Design Patterns - Getting Started Design Patterns
- PostgreSQL - Getting Started PostgreSQL
- Linux Commands - lsof command to list open files and kill processes Reference Linux
- Compounding and Discounting Money