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

All numbers have an infinite number of digits.

No, not the counting numbers (i.e. integers).