Behavior of Python ** and % operators with big numbers

前端 未结 4 1407
一整个雨季
一整个雨季 2021-01-23 11:03

When I put in Python interpreter a ** b % c with large a (20 figures) b (4 figures) c (20 figures) I saw that Python calculates it pretty fast, almost like pow (a,b,c). I expect

4条回答
  •  半阙折子戏
    2021-01-23 11:50

    20 figures is laughably small on a modern computer. Try 2000 figures and you might see a difference.

    Also, this past question is related: How did Python implement the built-in function pow()?

提交回复
热议问题