On Tue, Apr 9, 2024 at 7:52 PM Derick Rethans <der...@php.net> wrote:

> Adding a new native type to PHP will create a large change. Not only is
> it "just" adding a new native type, it also means all of the conversions
> between types need to be added. This is not a small task.

I understand this :)


> If you want to use arbitrary precision natives, then a precision and
> scale as defined in php.ini defeats the purpose. Every installation can
> then potentially calculate things in a different way.
>
> The only way how to prevent that, is to have *actual* Decimal type, such
> as the Decimal type in MongoDB uses (the IEEE 754 decimal128 type):
>
> - 
> https://www.mongodb.com/docs/mongodb-shell/reference/data-types/#std-label-shell-type-decimal
> - https://en.wikipedia.org/wiki/Decimal128_floating-point_format

If PHP core experts think that 128-bit decimal will cover the vast
majority of cases and is worth implementing, I'm totally for it. If we
can implement something standardized then fine. The current thread is
not an RFC candidate, but a kinda discussion board to formulate the
design principles and strategy.

On another note, is it possible to make zval variable size - 64 or 128
bits? So the 128-bit decimal can be a struct that will be held in the
stack instead of pointer manipulations. Can it be achieved with the
help of macroses?

-- 
Best, Alexander

Reply via email to