On Wed, Jun 23, 2021 at 8:43 PM Kim Hallberg <hallberg...@gmail.com> wrote:
> Hello internals, > > The RFC for the clamp function is now open and under discussion, you now > have 2 weeks > to discuss, suggest improvements and open issues before voting is > considered. > > Any and all feedback is welcomed. > > The RFC is available for viewing here: https://wiki.php.net/rfc/clamp < > https://wiki.php.net/rfc/clamp> > The implementation is available in a PR here: > https://github.com/php/php-src/pull/7191 < > https://github.com/php/php-src/pull/7191> > > Thank you, > Kim Hallberg > The RFC is missing a precise description of how this function works with NaN and negative zero. The expected behavior is that if min or max are NaN, an exception is thrown, if num if NaN then NaN is returned, and the behavior wrt negative zero is unspecified. This makes for an IEEE754-2008 style clamping operation. Making negative zero smaller than positive zero would be an IEEE754-2019 style clamp. I'm not really convinced that this is a worthwhile addition, but also not particularly opposed to it. Regards, Nikita