Re: [RFC] [Discussion] Add 4 new rounding modes to round() function

From: Date: Sun, 03 Sep 2023 12:13:59 +0000
Subject: Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-120975@lists.php.net to get a copy of this message
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

« previous php.internals (#120975) next »