On Friday, 31 May 2024 at 15:49, Saki Takamachi <s...@sakiot.com> wrote:

> Hi, internals!
> 
> I would like to start an RFC discussion regarding rounding modes.
> https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum
> 
> As mentioned previously by Gina on the mailing list [1], there are some 
> issues with PHP's current rounding mode.
> [1] - https://externals.io/message/123126
> 
> • First, the value is just an int, so we need to verify that the value passed 
> is a valid rounding mode.
> • The second problem is that the behavior of the “up” and “down” modes does 
> not match the mathematical definition. Especially for non-native speakers, 
> the different rounding modes might also be more easily confused, compared to 
> a naming that uses less abstract terms.
> 
> To resolve these issues, change the naming to something appropriate and use 
> Enums instead of int constants.
> 
> Please see the RFC for details.
> 
> Regards,
> 
> Saki

IMHO, part of the RFC should be to amend the "Add 4 new rounding modes to 
round() function" RFC [1] by *removing* the newly introduced constant and 
instead exposing the functionality *only* via the new Enum.
Especially as those constant have not yet been in a stable release of PHP.

Other than that, and seeing the confusing of some other people, maybe using the 
names "TowardsPositiveInfinity" and "TowardsNegativeInfinity" is better.


Best regards,

Gina P. Banyard

Reply via email to