How to safely and reasonably convert a float or double to string or char array?

oqibidipo:
libprintf_min.a is not the default printf, but an even more stripped down version.
The default version is in libc.a.

Here is the exact piece of code that I have in "Compiler.java" to do the job:

///////////////// this provides the floating point option /////////////////

if (Preferences.getBoolean ("build.printf_floating_point")) {
    baseCommandLinker.add ("-Wl,-u,vfprintf,-lprintf_flt");
}

if (Preferences.getBoolean ("build.scanf_floating_point")) {
    baseCommandLinker.add ("-Wl,-u,vfscanf,-lscanf_flt");
}

///////////////// this provides the floating point option /////////////////

...and this code provides the check boxes in "Preferences,java" to select or deselect either one:

// [ ] printf Floating point support
useFFloatingPointBox = new JCheckBox (("  Enable (f)printf floating point"));
useFFloatingPointBox.setToolTipText (getToolTip ("Enable floating point support for printf"));
pane.add (useFFloatingPointBox);
d = useFFloatingPointBox.getPreferredSize();
useFFloatingPointBox.setBounds (left, top, d.width + 10, d.height);
right = Math.max (right, left + d.width);
top += d.height + GUI_BETWEEN;

// [ ] scanf Floating point support
useSFloatingPointBox = new JCheckBox (("  Enable (f)scanf floating point"));
useSFloatingPointBox.setToolTipText (getToolTip ("Enable floating point support for scanf"));
pane.add (useSFloatingPointBox);
d = useSFloatingPointBox.getPreferredSize();
useSFloatingPointBox.setBounds (left, top, d.width + 10, d.height);
right = Math.max (right, left + d.width);
top += d.height + GUI_BETWEEN;

And finally this code reads and writes the preferences in "Preferences.txt":

// in "applyFrame()"
setBoolean ("build.printf_floating_point", useFFloatingPointBox.isSelected());
setBoolean ("build.scanf_floating_point", useSFloatingPointBox.isSelected());

// in showFrame()
useFFloatingPointBox.setSelected (getBoolean ("build.printf_floating_point"));
useSFloatingPointBox.setSelected (getBoolean ("build.scanf_floating_point"));

I know why the Arduino IDE developers haven't included such a useful option... it's SO complex!