0

Do we can view, how class int in python handles negative numbers by using two's complement? I want to see source code for that not theories, I already understand how that happens in cs but I don't touch how happens in real languages.

Thankful advance for your help.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • Look at the cpython source code from github. You should be able to locate the integer arithmetic package. – Tom Karzes Sep 25 '21 at 12:03
  • I didn't find it here:https://github.com/python/cpython –  Sep 25 '21 at 12:18
  • 1
    It's all there. Look at [`https://github.com/python/cpython/blob/main/Include/longintrepr.h`](https://github.com/python/cpython/blob/main/Include/longintrepr.h) and [`https://github.com/python/cpython/blob/main/Objects/longobject.c`](https://github.com/python/cpython/blob/main/Objects/longobject.c) – Tom Karzes Sep 25 '21 at 12:31

0 Answers0