>> The value is a float that is not NaN or infinity
>
> It feels a bit odd to have a value where is_float($v) would be true, but 
> is_representable_as_float($v) would be false. I'd be interested to understand 
> the thinking behind this case.

As the strings “INF” and “NAN” can't be cast as floats directly, I
think it's safer to return false on these extreme values. See
https://3v4l.org/TabMK#vnull for the cast example.

> I suggest removing that sentence and example completely. There is nothing the 
> function can or should do differently on different platforms.

You are right, it's misleading. I'll update the RFC accordingly.

> This one is fair enough, but I'd suggest tweaking the example slightly to 
> avoid the same problem with different inputs: on a 64-bit build, 2**31 
> already is an integer, so it's trivially true. So either force a floating 
> point input:
>
> is_representable_as_int(2.0**31); // true on 64-bit platforms, false on 
> 32-bit platforms
>
> or, perhaps clearer, use an out-of-range string input:
>
> is_representable_as_int('2147483648'); // true on 64-bit platforms, false on 
> 32-bit platforms

I'll also update accordingly. Thank you!

Best,
Alexandre Daubois

Reply via email to