Conversion From Float to String
I have searched the forum , also over internet but i didn't found any understandable method to convert float number to string , Please help Me in conversion.
Majestics
Practically a Master Poster
621 posts since Jul 2007
Reputation Points: 199
Solved Threads: 49
look up stringstream. However, note that some floats cannot be completely represented by a stream. Therefore, only a "limited" number of digits will appear in the decimal portion of the string. Consider the float representation of 1/3. I'ts 0.3333... where 3 goes on indefinitely. When converted to a string the number of 3s in the float will be truncated.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
>Is there a reason not to use strtod( )?
I can only think of one reason, but it's a doozy. strtod works in the wrong direction. The OP wants a conversion from float-point to string, not string to floating-point.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228