I have a requirement to store very small double numbers into a string format and then later reverse them. However, when I try to run std::to_string()
on a small number like 4.7816457028269855e-143
then it simply makes it 0.
I referred Set precision of std::to_string when converting floating point values and its linked duplicate. But will setting the precision to a very large number solve this issue in all the platforms?
How to fix this issue?
Using any alternatives to to_string()
is fine.