Le lun. 28 juil. 2025 à 12:18, Claude Pache <claude.pa...@gmail.com> a écrit :
> This is not correct: 2**53 + 1 is perfectly “safe” (for 64-bit builds of 
> PHP), see: https://3v4l.org/P939d
>
> The specific notion of “safe integer” as introduced in JavaScript makes sense 
> only for numbers encoded using IEEE 754, which is what PHP uses for `float`. 
> In PHP, there is a specialised type for integers, so that the need of such a 
> function is not clear, because every integer encoded as `int` is “safe”. Or 
> maybe you want something like `is_safe_integer_when_interpreted_as_float()`?
>
> Also, note that the particular Symfony example given at the beginning of this 
> thread uses a function that expects a string, not an int or a float. In that 
> example, something like 
> `is_numeric_value_producing_exact_integer_when_interpreted_as_float()` could 
> have been useful, but this use case is very specialised.
>
> —Claude

Right! I think we found Gina proposed a nice alternative. I wrote a
few specs in my last thread message in response to Gina. Please let me
know if there's something that is unclear or bothering you.

Best,
Alexandre Daubois

Reply via email to