Search code examples
pythonmathfreeze

Why does my Python freeze when I do an overflow calculation?


I'm a MATLAB user trying to understand Python so sorry if this is obvious.

If I say

print(9**9)

I get: 387420489

Great.

If I say print(9**9**9) Python just sits there indefinitely and freezes (I use Spyder version 4). Ctrl-C doesn't stop it. Why does it not just immediately return Inf? Is this expected behavior?


Solution

  • the num 9**9**9 is very big to caculated
    you can wait untill it will return a result
    it can take much long time