TLDR: How Python Handles Gigantic Integers
Date: 2020-01-10 Source: https://arpitbhayani.me/blogs/long-integers-python
Overview
Explore Python's arbitrary-precision integers! Learn how it handles large numbers internally, from storage to operations like addition. ob_digit is an array of type digit, typedef’ed from uint32_t, statically allocated to length 1.
Key Points
- Decoding
ob_digit: ob_digit is an array of type digit, typedef’ed from uint32_t, statically allocated to length 1. - The pythonic way: Instead of storing just one decimal digit in each item of the array ob_digit, python converts the number from base 10 to base 2^30 and calls each of element as digit which ranges from 0 to 2^30 - 1.