Outputting to file rounding problems

I am currently trying to output an array of integers to a file, I have got it working however I am dealing with some small numbers and the output is messing up. Below is some of the code:

1
2
3
for(eigenvalNum=0; eigenvalNum<numberOfEigenvalues; eigenvalNum++){
			eigenvalues << clusterPerimeters[molnum][eigenvalNum] << ", " ;
		}


Some example output is shown below:

0.000569678, 0.00232422, 5.72559e-05, -0.000187779, 5.69845e-06, 0.996057, -0.000198437, -3.9462e-05


As you can see for the most part it is correct however some of the numbers are so small that it is outputting things like 5.72559e-05 which I need rounded down to 0. I still require the accuracy for the other numbers however. I'm sure this isn't to hard a problem to fix but I have no idea where to look. Any help would be appreciated, thanks.
Assume that 'value' is 'clusterPerimeters[molnum][eigenvalNum]':

eigenvalues << (value < 0.0001 ? 0 : value) << ", ";

Is this what you want?
Topic archived. No new replies allowed.