I am trying to figure out how to print floating point numbers without using library functions. Printing the decimal part of a floating point number turned out to be quite ea
It appears that the work horse for the float to string conversion is the dtoa()
function. See dtoa.c in newlib for how they do it.
Now, how does printf manage to print the correct result?
I think it is close to magic. At least the source looks like some kind of dark incantation.
Does it use some bigint facilities internally?
Yes, search for _Bigint
in the linked source file.
Or is there some floating point trick I am missing?
Likely.