# Negative decimal to other base conversion

I'm trying to learn on how to convert a negative decimal number (with fraction) to binary, octal and hexadecimal.

So, base 10: -89.3125

Here is what I did to convert this to binary:

-89= 1011001 (positive) // 0100110 (invert) // +1 (add one) =0100111

I then represent the number in paper as (1)0100111

For the fraction part:

1-0,3125=0,6875=1,1011

So final result: (1)0100111,1011

Converting this result to Octal: 647,54

I'd like to know if my logic of conversion is correct, for the Octal/Hexadecimal conversion, I simply divided the binary number in groups of 3 and 4 respectively - from right to left before the ',' and left to right after the ','.

I tried finding an online calculator for all of this, but to no success... so I'm kinda shooting in the dark here.

-

The $-$ sign is not something special to base $10$. In general if $83.5_{10} = 1010011.1_2$ then $-83.5_{10} = -1010011.1_2$. What you are doing here is an extension of two's complement. Two's complement is a method to represent both positive and negative numbers in binary without using a $-$ and is used in computing. Also, it only works for integers. This is how fractions are represented.