I am attempting to output long doubles to a text file, But when outputting the data I am getting data such as.
0.1,0.1,0.1
When I am expecting.
0.10000000000480658, 0.10000000632434904, 0.10000000000000001
The code I am currently using is below.
ofstream fileDump("2Stars.dump.csv");
for (auto star: star_list) {
int cycle_id = 1;
for (auto history : star->history_position) {
fileDump << star->id << ',' << cycle_id << ',' << history.x << ',' << history.y << ',' << history.z << std::endl;
++cycle_id;
}
}
fileDump.close();
I have seen a few 'solutions' to similar issues but all of them seem to involve using string streams that don't seem to work any differently.
I have also tried using toString but that just outputted 0.1000
.