Many programming languages that use IEEE 754 doubles provide a library function to convert those doubles to strings. For example, C has sprintf
, C++ has
For most example languages you quote the source is freely consultable online as they're available in open source.
For Java, the class java.lang.Double delegates this work to sun.misc.FloatingDecimal. Check out its constructor and toJavaFormatString() method.
For C, glibc is always a good example, and there we see that floating point output is located in its own source file.