Floating point hex binary

I am working on a calculator that allows decimal point calculations in octal, hexadecimal, binary, and of course decimal. I am having problems though I have found a way to convert floating point decimal numbers to hexadecimal, octal, binary and hexadecimal floating point numbers and vice versa.

The plan is to do all of the math in decimal form and then convert the result to the appropriate number system. Any help, ideas or examples would be appreciated.

Thank!

+1


source to share


3 answers


Hmm ... that was homework for my university's spall course.

Operations for binary files are described in the series "Shaum": "Essential Computer Mathematics" by Seymour Lipschutz. For some reason, it is still on my bookshelf 23 years later.



As a hint, convert octal and hexadecimal to binary, perform operations, convert back to binary.

Or you can do decimal operations and do octal / hex / binary conversions. The process is essentially the same for all positional arithmetic systems.

+2


source


What programming language are you using? it's definitely a good idea to change everything in binary so that the binary math is converted back. if you multiply a binary number (unsigneD) by 2, ti is the same as the left shift bit (<1 in C), division by 2 is the same as the shit Right bit (→ in C). addition and subtraction is the same as in elementary school.



also remember that if you create a float as an int it will truncate it int (10.5) = 10;

+1


source


I had this same problem a few days ago. I found http://www.binaryconvert.com that allows converting between decimal, binary, octal and hex floating point numbers in any order.

0


source







All Articles