2
$\begingroup$

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

And to Hexadecimal: A7,B

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.

1 Answers 1