'What does "e" mean in logged output of a floating point number
If I std::cout
a float or a double and if logs something like -5.58794e-09
, then does this mean that the number is close to zero?
This is very basic programming question and not necessarily related to C++.
Solution 1:[1]
This is an instance of scientific notation called E Notation, where the 'e' means "powers of 10." In this style -5.58794e-09
means -0.00000000558794
; a decimal (one negative power of 10) and eight zeros (the other eight negative powers of 10) before the original digits.
Whether or not you consider this "close to zero" depends on what you are using it for.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | goatshriek |