read the transcript!
integers don’t have to overflow
Instead, integers can expand to use more space as they get bigger. Integers that expand are called “big integers”.
big integer: I’m going to use ONE THOUSAND bytes of space!
big integer math is slower
It’s slower because it’s implemented in software, not hardware.
So a big integer addition is actually turned into lots of smaller additions.
how big integers are represented (in Go, as of 2023)
You can think of this array of 64-bit integers as being the number written in base 2^64
some languages only have big integers
Python 3 and Ruby: we’d rather have slower math and no weird overflow problems!
This works because people don’t do a lot of math in Ruby/Python (except with numpy, which doesn’t use big integers).
some languages offer big integers as an option
when are big integers useful?
- they’re used in cryptography (e.g. for large key sizes)
- for math on really big integers