What number is e+000?

前端 未结 1 967
执念已碎
执念已碎 2021-01-14 01:25

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 re

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-14 02:12

    The number -4.60517025e+000 is interpreted as -4.60517025 × 100 = -4.60517025.

    More generally, a number of the form

    AeB
    

    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!

    0 讨论(0)
提交回复
热议问题