Re: Native decimal scalar support and object types in BcMath - do we want both?
| From: | Rowan Tommins [IMSoP] | Date: | Mon, 08 Apr 2024 13:38:55 +0000 |
| Subject: | Re: Native decimal scalar support and object types in BcMath - do we want both? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123043@lists.php.net to get a copy of this message | ||
On Mon, 8 Apr 2024, at 13:42, Arvids Godjuks wrote:
> The ini setting I was considering would function similarly to what it does for floats right now
> - I assume it changes the exponent, thereby increasing their precision but reducing the integer
> range they can cover.
If you're thinking of the "precision" setting, it doesn't do anything nearly
that clever; it's purely about how many decimal digits should be *displayed* when converting a
binary float value to a decimal string. In recent versions og PHP, it has a "-1" setting
that automatically does the right thing in most cases. https://www.php.net/manual/en/ini.core.php#ini.precision
The other way around - parsing a string to a float, including when compiling source code - has a lot
of different compile-time options, presumably to optimise on different platforms; but no user
options at all: https://github.com/php/php-src/blob/master/Zend/zend_strtod.c
Regards,
--
Rowan Tommins
[IMSoP]