Hi,

IMHO, the more meaningful cases of the RFC are missing :

round(float, precision: >= 0): int|float // only cast to float for int overflow
ceil(float): int|float // only cast to float for int overflow
floor(float): int|float // only cast to float for int overflow

Calling ceil or floor on integer is meaningless, because it will return the
same value.
The RFC should be "Prefer int as return value when possible".

Le dim. 17 mars 2024 à 15:00, Bob Weinand <bobw...@hotmail.com> a écrit :

> On 17.3.2024 13:23:04, Marc Bennewitz wrote:
> > Hello internals,
> >
> > I have opened the vote for the "Rounding Integers as int" RFC:
> > https://wiki.php.net/rfc/integer-rounding
> >
> > Do to Easter weekend the vote will run for two weeks and two days
> > until Tue the 2nd of April 2024.
> >
> > Best regards,
> >
> > Marc Bennewitz
>
> Hey Marc,
>
> I've voted no; it should be just changed without any force_float
> parameter. Just always return int when possible (and the input was int).
> If users wish to have the old behaviour, they should just explicitly
> cast via (float).
>
> The effective BC break of that would be quite small if some things which
> return float today now would return int. I cannot imagine many cases
> where this would actually be unwanted. And as said, explicit (float)
> casts are always possible.
>
> I also dislike force_float, as it cannot just be added to a function in
> any code which shall be backwards compatible to 8.3 and older. It would
> just emit Uncaught Error: Unknown named parameter $force_float.
>
> Bob
>

Reply via email to