Hello, I am trying to write a program that converts a floating point number into IEEE 32 and IEEE 64 bit hexadecimal representation. To do this, I can not use any built in converting functions of C++.
I was wondering if someone could show me a function that takes in an char array(max size 256) and prints the hexadecimal representation of that floating number. The number can be a negative or a positive.
The question "number to hex" has been answered multiple times in this and other forums. I find it surprising that a Google search wouldn't give you the answer. For example: http://bit.ly/HUnDiM . Second result seem to point to the simplest way of doing this in C++.
The reason I am having trouble with this program is because we are not allowed to use such functions as "hex", "atof()", "%x" or any built in class functions.
So, if anybody could set me in the right direction on how to go about doing this, that would greatly appreciated.