Powers of 10 not working correctly in Python: multiplying by 10**7 not returning the same as 10e7

Viewed 89

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.

Related