Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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.

share|cite|improve this question

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.

share|cite|improve this answer
I see. I read about converting fraction from here: , so I'm guessing this technique also follows the two's complement rule? – Joao Ferreira Sep 1 '12 at 10:38
I'm not sure what kind of representation that text is talking about. The words "sign bit" should hint that some use with computers is intended. The method of converting positive fractions is correct. – Karolis Juodelė Sep 1 '12 at 11:31
There's more than one way of representing fractions - just a pair of integers is sometimes a good one. – Ben Millwood Sep 1 '12 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.