Re: Proposal: native decimal scalar type support

From: Date: Fri, 05 May 2023 15:41:08 +0000
Subject: Re: Proposal: native decimal scalar type support
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-120194@lists.php.net to get a copy of this message
On Wed, 26 Apr 2023, Alexander Pravdin wrote: > A decimal builtin scalar type with some predefined precision > (probably configured in php.ini). I can set the precision explicitly > like decimal(10,4). Introducing a real decimal type is not an easy feat. First of all, we would probably need to bundle a library — such as MongoDB does: https://github.com/mongodb/mongo/tree/master/src/third_party/IntelRDFPMathLib20U1 Adding another scalar type also means that support for this needs to be added a lot of code paths in the source code, as well as in tools (IDEs, static analysers, debuggers). And then additionally semantics needs to be created on what to do if you add the existing float or int types to these new decimal types. > Good solution: > Make the php-decimal PEAR extension built-in and available by default. You mean the PECL extension (http://pecl.php.net/package/decimal)? This is possible, but I am not sure how much of a use case there is for these Decimal types and therefore I am slightly reluctant to add real native scalar decimal types, as it is such a large endeavour. cheers, Derick

« previous php.internals (#120194) next »