Here is a very closely related, but NOT a duplicate question.
One time, I decided to test how long it takes to compute $2^x$ compared to $e^x$ in Python. I expected $2^x$ to be faster as in binary, the base computers use, you can just append 0 to the number 1 $x$ times. I entered into Python IDLE (Python's Integrated Development and Learning Environment):
>>> import timeit
>>> timeit.timeit('2**100')
>>> 0.24405850004404783
>>> timeit.timeit('e**100','e=2.718281828459045')
>>> 0.10122330003650859
and found that $e^x$ was about twice as fast to compute, despite not being an integer. Why does this happen? (Note that this only happens for large numbers.) The only reason I can think of is that $e^x$ can be easily calculated using a MacLaurin series as $\frac d{dx} e^x$ is equal to $e^x$.
timeit.timeit('total += e**100', "e, total =2.718281828459045, 0")
: What is your platform? $\endgroup$ideapad Flex 5
. $\endgroup$>>> timeit.timeit('2.0**100')
>>> 0.0073371000000008735
$\endgroup$