I have always used streams, printf, string(x) or whatever the language in question offered to convert numeric types to a string or back. However I have never really considered how this is actually done. I searched around on Google, but all the results are just to use those varies methods, and not how the conversion is really done behind the scenes :(
For integers using binary, octal and hexadecimal seems fairly straight forward since each "digit" in the string represents a set group of bits (eg for the 2 hex digits I know its xxxxyyyy), so I could do it with bit shifts and taking one digit at a time, eg for the hex string 0xFA20 the value is "(15 << 12) | (10 << 8) | (2 << 4) | (0 << 0)".
Decimal integers are more difficult since base 10 doesn't map to base 2 like that and so one bit may effect more than one decimal digit making conversion both ways more complex...
As for floating point numbers I really have no idea. I guess the whole and fractional parts could be considered separately or something? What about as an exponential, a set number of significant figures or set number of decimal places?