Re: Proposal: Arbitrary precision native scalar type

From: Date: Mon, 08 Apr 2024 09:38:46 +0000
Subject: Re: Proposal: Arbitrary precision native scalar type
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-123034@lists.php.net to get a copy of this message
On Mon, Apr 8, 2024 at 5:06 PM Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk> wrote: > If we ever do want to make decimals a native type, we would need some way to initialise a > decimal value, since 1.2 will initialise a float. My original suggestion was: - Add "default decimal" mode with the "declare" statement in the beginning of the file. With this statement, all decimal literals like 1.2 will compile to decimals internally, not to floats. - Add "(decimal) 1.2" typecast that will compile to a decimal number representation when there's no "default decimal" statement in the file. So users will be able to switch contexts explicitly and always know what they're dealing with. -- Best, Alexander.

« previous php.internals (#123034) next »