I want to store a float value into string without lossing or adding any single precision digits.
For example if my float value is 23.345466467 , I want my string to have str = “23.345466467” exact digits.
I tried using CString format function with %f. Its giving only first 6 precision.
or if i use %10 , if my float value is having less than 10 precision,its adding some more junk precision. I want to get exact float value into my string. how to do this?
1st of all: you can’t convert floating to string and back without probably loosing a bit or two. As it is not 1-to-1 conversion as they use different base.
For preserving the best accuracy for floating point type:
Or more generic
It would cut off digits you do not need but keep highest precision possible.