Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Larry Garfield
On Tue, Aug 26, 2025, at 1:36 PM, Tim Düsterhus wrote: > Hi > > On 8/26/25 16:48, Larry Garfield wrote: >> I have multiple times just recently had need of "I have a numeric string, >> should I cast it to an int or a float?", for which an >> is_representable_as_int() function (or similar) would be

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Nicolas Grekas
Le mar. 26 août 2025 à 21:38, Larry Garfield a écrit : > On Tue, Aug 26, 2025, at 1:36 PM, Tim Düsterhus wrote: > > Hi > > > > On 8/26/25 16:48, Larry Garfield wrote: > >> I have multiple times just recently had need of "I have a numeric > string, should I cast it to an int or a float?", for whic

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Tim Düsterhus
Hi On 8/26/25 19:14, Alexandre Daubois wrote: 3.14 is not exactly representable as a IEEE-754 double-precision floating point number. The two nearest representable values are 3.14012434 (this one is the nearest) and 3.13968026. Returning `true` for `is_representable_as_fl

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Tim Düsterhus
Hi On 8/26/25 16:48, Larry Garfield wrote: I have multiple times just recently had need of "I have a numeric string, should I cast it to an int or a float?", for which an is_representable_as_int() function (or similar) would be quite helpful, and neater than the messy solution I usually use.

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Rob Landers
On Tue, Aug 26, 2025, at 20:23, Tim Düsterhus wrote: > Hi > > On 8/26/25 19:14, Alexandre Daubois wrote: > >> 3.14 is not exactly representable as a IEEE-754 double-precision > >> floating point number. The two nearest representable values are > >> 3.14012434 (this one is the nearest

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Alexandre Daubois
Hi Larry, > I have multiple times just recently had need of "I have a numeric string, > should I cast it to an int or a float?", for which an > is_representable_as_int() function (or similar) would be quite helpful, and > neater than the messy solution I usually use. Indeed, this is a nice use

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Alexandre Daubois
Hi Tim, Thank you for your thorough review. > 3.14 is not exactly representable as a IEEE-754 double-precision > floating point number. The two nearest representable values are > 3.14012434 (this one is the nearest) and > 3.13968026. Returning `true` for > `is_representabl

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Larry Garfield
On Tue, Aug 26, 2025, at 9:30 AM, Tim Düsterhus wrote: > For `is_representable_as_int()` finding a reasonable definition is much > easier, but I don't think I've ever had a use case where I needed to > know whether a non-integer value is exactly representable as an int. > > Long story short: Wha

Re: [PHP-DEV] [RFC] Create "split" as an alias to "explode"

2025-08-26 Thread Vinicius Dias
> I believe it now fairly represents the discussion and I don't think anything > important is missing from the RFC. Perfect, thank you. I plan to open it for voting next Monday (Sep 1st) since it will be 2 weeks since this discussion started.

Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

2025-08-26 Thread Tim Düsterhus
Hi Am 2025-07-29 14:52, schrieb Alexandre Daubois: I would like to present the RFC to add the "is_representable_as_float()" and "is_representable_as_int()" functions. These functions provide developers with a way to check whether values can be losslessly converted between integer and floating-po

Re: [PHP-DEV] [RFC] Add clamp function

2025-08-26 Thread Tim Düsterhus
Hi Am 2025-08-22 10:01, schrieb Kyle Katarn: I created https://wiki.php.net/rfc/clamp_v2 (re-using most of the info from https://wiki.php.net/rfc/clamp). I'm noting that the status of the RFC still is Draft and it's also listed in the “Draft” section of the RFC overview. I'm seeing that some

Re: [PHP-DEV] [RFC] Create "split" as an alias to "explode"

2025-08-26 Thread Tim Düsterhus
Hi Apologies for the late response. I've now taken another look. Am 2025-08-19 16:50, schrieb Vinicius Dias: The template specifically contains an RFC impact section that is missing from your RFC: I added that and the RFC Impact sections. I added "None" to the existing extensions and SAPIs. L

Re: [PHP-DEV] [RFC] [Discussion] Recommend PIE and deprecate PECL

2025-08-26 Thread Tim Düsterhus
Hi Am 2025-08-25 09:38, schrieb Derick Rethans: Ideally we have a page in the docs like this, , for which we then can setup a short url (which we should also do for /composer). In fact there's already a mention of PECL extensions in th

Re: [PHP-DEV][DISCUSSION] Deprecate mbregex in PHP 8.6 and maintenance version

2025-08-26 Thread Derick Rethans
On Mon, 25 Aug 2025, Christoph M. Becker wrote: > On 25.08.2025 at 09:26, youkidearitai wrote: > > > I improvement this RFC. https://wiki.php.net/rfc/eol-oniguruma > > > > Added more information about maintenance versions. What do you think > > about Oniguruma maintenance ended. Please watch an