> > Someone tangential to your proposal, have you given any thought to > implementing this similar to how Python treats numbers? >
Unfortunately, I don't know many details of numbers treatment in Python... In Python, integers have unlimited precision. I’m not sure how they store > the values internally, but to users of Python, any sequence of numbers is > an `int`, no matter how long it is. > > For example, this multiplies the max 64-bit, signed integer by 2, and the > result is still an `int`: > > >>> i = 9223372036854775807 * 2 > >>> i > 18446744073709551614 > >>> type(i) > <class 'int’> > > And this is a really, really, really long number that’s still an `int`: > > >>> x = > 9223372036854775807922337203685477580792233720368547758079223372036854775807 > >>> x > > 9223372036854775807922337203685477580792233720368547758079223372036854775807 > >>> type(x) > <class 'int’> > I'm not sure about integers, I mostly care about decimals :) Decimals can hold big rounded ints as well. The limit on the maximum number here will be the underlying library's limit. However, if we can achieve arbitrary-length integers, is there a reason we > couldn’t also have arbitrary length floating point numbers? > I'm not familiar with arbitrary-length integers so I don't know what to say here... > Below a certain threshold, we could use the system’s native int and double > for storage and math. Above a certain threshold, we could internally switch > to a bundled library for handling arbitrary-precision integers and floats, > and it would be seamless to the user, who would see only `int` and `float` > types in PHP. > I guess this could be a topic of the next step discussion after "decimal" introduction. Anyway, this is something I’ve been thinking about for some time, but I > haven’t taken the time to look into what it might take to implement it. It > sounds like you have looked into it, so I’m interested to know whether you > think what I’ve described here is feasible. > I was only thinking about decimals and I'm not an expert in low-level manipulation of numbers. Best regards, Alex.