Hi

On 9/2/23 21:33, Jorg Sowa wrote:
RFC: https://wiki.php.net/rfc/new_rounding_modes_to_round_function

The RFC mentions already has a section with regard to naming:

> Why not the names PHP_ROUND_UP and PHP_ROUND_DOWN

I generally agree with the argument in favor of the names you've chosen. However they are inconsistent with the existing 'PHP_ROUND_HALF_UP' / DOWN constants.

I don't want to create extra work for you, but I wonder if additionally one of the following should be done:

- Creating PHP_ROUND_HALF_AWAY_FROM_ZERO as an alias for PHP_ROUND_HALF_UP (and likewise for HALF_DOWN). - Adding an entirely new \RoundingMode enum with clear names for all variants. I feel like documenting such an enum with a dedicated page would be easier compared to the PHP_ROUND_* constants which are not directly related, except for the prefix.

Furthermore there will be another inconsistency by not having the CEIL/FLOOR variants for the halfway point (i.e. half towards positive infinity and half towards negative infinity).

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to