I've converted a double value into string using to_string(). But after converting when I check the length of the string it returns an invalid value.
1 2 3 4 5 6 7 8 9 10 11 12
#include <bits/stdc++.h>
usingnamespace std;
int main()
{
double n=123.456;
string s=to_string(n);
int l=s.length();
cout<<l<<endl; //It prints 10. Where the string length is 6.
return 0;
}