🤯 Today, I learned a new thing: Python int type has no limit🐍 Python’s int type can handle numbers of any size. No overflow. No upper bound. Just… works. In T‑SQL, even BIGINT will fail when you try to cast 49958149752019560004995814975201956000 to BIGINT, but Python happily accepts numbers far beyond the 64‑bit range as plain int values. One of those moments that reminds you how differently languages treat something as simple as a number. #Python #Type #TypeSystem
And Oracle int is an alias for number(38) so you can have 99999999999999999999999999999999999999 in that column.
Not just Python. Ruby is another language that works this way by default. C# and Java can also get there, via their respective BigInteger structures. I’m sure there are many other examples. DBMS type systems are a bit behind the curve here.
I created a hugeint class in SQL 2012 the first day it came out. We didn't 'use it in production' but it was a proof of concept for storing (more than 64) bitwise operators in a single answer. .NET upgrade moving to SQL 2012 gave like a 10-20x performance improvement. I have SOME of the code, but I don't think it would work today (because I'm missing SOME of the code from CodePlex)..
I don't see any value of such numbers if the rest of the ecosystem is unable to deal with them.
I have ever wished I programmed in Python more, because I know really want to know what the limit is :). Like I would just do a loop and keep multiplying by 10 and see what crashed first, Python or my computer
Interesting! What are some use cases for 40-digit integers?
Try Lisp, there is "no limit". Besides it will store 1/3 as such, so if you calculate (* 3 1/3) it will return 1. No rounding issue.