Re: Proposal: Arbitrary precision native scalar type
| From: | Larry Garfield | Date: | Tue, 12 Dec 2023 21:25:44 +0000 |
| Subject: | Re: Proposal: Arbitrary precision native scalar type | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121992@lists.php.net to get a copy of this message | ||
On Tue, Dec 12, 2023, at 1:03 PM, G. P. B. wrote:
> The issue is that I don't think having arbitrary precision decimals as a
> core language feature is a necessity compared to rational types.
> A cast from rational to float wouldn't produce a large round trip, whereas
> trying to figure out arbitrary precision is more difficult.
> But in any case, having a declare/INI or whatever that changes the
> behaviour of the engine/language is not a good design choice.
I don't have strong feelings about arbitrary precision decimals either way, but I do strongly
agree with this point. Having the language behavior (including the precision of numbers) change
with an ini setting is long-understood to be a bad idea, and we've been trying to phase it out.
A decimal feature that relies on a language-affecting ini setting is just not going to fly these
days, IMO, and rightly so.
I am curious, GB, if you're proposing an actual
rational type, which stores values
internally as just numerator and denominator separately until some point when it renders down to a
float (eg, on print)? That sounds neat, though I am nowhere near expert enough in that area to say
what ugly edge cases that might run into.
--Larry Garfield