Powers of 10 Not Working Correctly in Python: Multiplying by 10**7 Not Returning the Same as 10E7
I Thought the Syntax 10E7 Is Equivalent to 10**7. However, I Get the Following Odd Output That I Do Not Understand. -8.555376292852173*(10**7) Returns...
I thought the syntax 10e7 is equivalent to 10**7.
However, I get the following odd output that I do not understand.
-8.555376292852173*(10**7)
returns
-85553762.92852174
And
-8.555376292852173*(10e7)
returns
-855537629.2852174
The output of the first is a factor 10 smaller than the output of the second. I am using Jupyter lab.
How come?
2 Answers
This is because 10**7 is indeed 10^7 but 10e7 is actually equal to 10*10^7. 1e7 is already 10^7.
Common mistake. You need 1e7, not 10e7. 10e7 is off by a factor of 10.