I have a data file full of numbers I’m loading into a vector of floats. However, the numbers in the data file are of the form -4.60517025e+000 but are being read in like -4.60517
What number should -4.60517025e+000 be?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The number -4.60517025e+000 is interpreted as -4.60517025 × 100 = -4.60517025.
More generally, a number of the form
is interpreted as A × 10B.
In your case, the file is being read properly, but the numbers are being rounded to some number of decimal points when being displayed. You can use stream manipulators to display them in their initial form.
Hope this helps!