Re: [RFC] [discussion] Correctly name the rounding mode and make it an Enum

From: Date: Mon, 03 Jun 2024 17:57:23 +0000
Subject: Re: [RFC] [discussion] Correctly name the rounding mode and make it an Enum
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi

On 6/3/24 19:02, Jordan LeDoux wrote:
If the behavior of that mode is to ALWAYS round regardless of the value of the remainder, then it should remain ceil IMO. It's a pretty well understood behavior in many programming languages. However, "HALF_TOWARDS_POSITIVE_INFINITY" is a different behavior, and should not be called ceil.
There's already HalfAwayFromZero + AwayFromZero as companion modes. It would make sense to me to also make it PositiveInfinity + HalfPositiveInfinity [1] instead of Ceil + HalfPositiveInfinity, which are appear to be unrelated based on their naming. That would make it clear that those two are closely related and also that all the modes starting with 'Half' would be the ones that are only relevant if the last digit is 5, whereas the others act unconditionally. Best regards Tim Düsterhus [1] Possibly with an 'Towards' inserted before the Negative/Positive.

Thread (27 messages)

« previous php.internals (#123496) next »