> On 28 Jun 2021, at 11:16 AM, Nikita Popov <nikita....@gmail.com> wrote:
> 
> 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

Will update the RFC with a more precise description. Didn’t know there existed 
IEEE standards for clamping operations. Adding exceptions for NaN values into 
min/max is something I agree would be expected behaviour since a non number in 
the range don’t really make sense.

As for the negative zero behaviour though, I’m not sure how to address that 
since frankly it’s out of my league, and when would a range of -0, 0 make sense 
to have? Cannot see a value being placed between that expect for 0, so a 
`clamp(0, -0, 0)` would return 0 then?

Thanks, Kim.

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

Reply via email to