My txt is full of floating point numbers, like this:
-6.279745101928710938e+00 -6.499424934387207031e+00 -6.950426101684570312e+00 -7.428587913513183594e+ ...
My code:
std::vector<std::vector<double>> voice(10, std::vector<double>(10));
ifstream fp("../target.txt");
if (!fp) {
cout << "Error, file couldn't be open" << endl;
return 1;
}
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
{
if ( !fp )
{
std::cout << "read error" << std::endl;
break;
}
fp >> voice[i][j];
}
}
std::cout << "0 0:" << voice[0][0] << std::endl;
std::cout << "0 1:" << voice[0][1] << std::endl;
I get
0 0:-6.27975
0 1:-6.49942
The precision of floating point numbers is discarded, how can I get the full float from the txt?